CLLocationManager authorization issue iOS 8 CLLocationManager authorization issue iOS 8 swift swift

CLLocationManager authorization issue iOS 8


It's an iOS 8 related issue. You have to put NSLocationAlwaysUsageDescription or NSLocationWhenInUseUsageDescription keys in your .plist file (value may be an additional message that will be presented in location alert). These keys are required in iOS 8.

How it's said in Apple guidelines:

This key is required when you use the requestAlwaysAuthorization method of the CLLocationManager class to request authorization for location services. If this key is not present and you call the requestAlwaysAuthorization method, the system ignores your request and prevents your app from using location services.


I had struggled with a similar issue, which persisted even after adding the NSLocationAlwaysUsageDescription/NSLocationWhenInUseUsageDescription keys to the plist.

Eventually, I added the "Privacy - Location Usage Description" key to the plist (in addition to the new keys) and voila, it worked! After it worked once I was able to remove the "Privacy - Location Usage Description" key from the plist and continue to successfully request authorization.


iOS 8 has changed location authorization strategy. Solution with backward compatibility:

SEL requestSelector = NSSelectorFromString(@"requestWhenInUseAuthorization");if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined &&    [self.locationManager respondsToSelector:requestSelector]) {    [self.locationManager performSelector:requestSelector withObject:NULL];} else {    [self.locationManager startUpdatingLocation];}

Reminder: setup NSLocationWhenInUseUsageDescription key in your Info.plist