My Location
Handling standard iOS location permissions and engaging native user tracking.
Important iOS requirement
To use the location tracking features, your app must define usage descriptions in Info.plist:
- Add the key
Privacy - Location When In Use Usage Descriptionand provide a reason string. - Add the key
Privacy - Location Always and When In Use Usage Descriptionand provide a reason string.
Request location and enable tracking
func requestLocation() {
if locationManager.authorizationStatus == .notDetermined {
locationManager.requestWhenInUseAuthorization()
}
rawMapView?.showsUserLocation = true
rawMapView?.userTrackingMode = .followWithHeading
}
See also: iOS Map SDK overview.