Description
App is not asking for user permission to access location and getting state notDetermined
Working perfectly till iOS-10
var locationManager : CLLocationManager!
func getLocationDetails()
{
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.requestAlwaysAuthorization()
locationManager.allowsBackgroundLocationUpdates = true
locationManager.startUpdatingLocation()
}
func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus)
{
if status == CLAuthorizationStatus.authorizedAlways || status == CLAuthorizationStatus.authorizedWhenInUse
{
locationManager.startUpdatingLocation()
}
}
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation])
{
}
Plist screenshot
Background Modes
I have gone through the Apple documentation and found the solution for this question.
Apple has changed few guidelines to get user location.
Here is the Video Link: Apple- What's New in Location Technologies
Full code for location access in Swift & Objective-C both
Solution:
Now we need to add three Authentication Key into Plist:
Plist will look like : And Authentication message screen will look like:
Full code for location access
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With