#Swift 4.2
This is a sample code to get the latitude and longitude while using the app.
The label string is updated when the latitude and longitude of the terminal change.
Reference:
[iOS] 位置情報の取得 (Swift3編)
【CoreLocation】位置情報を取得する
If you use LocationManager, you must include the “purpose for which location information is used” in your Info.plist.
If you want to get location information only during startup
NSCattionWhenInUseUsageDescription
This app gets location information to guide you on the map
.
If you always want to get location information
NSCationAlwaysUsageDescription
.
This app always gets the location information to get the travel distance
.
When the location information is changed, a character will appear on the label.