Determining User Denied CoreLocation Permission

Is it possible to programmatically determine that the user has refused permission to use his location?

Secondly, if the user denied permission, can the user be re-requested?

+7
source share
2 answers

You can determine your authorization status using the authorizationStatus class method on the CLLocationManager . This returns a CLAuthorizationStatus , which is defined as:

 typedef enum { kCLAuthorizationStatusNotDetermined = 0, kCLAuthorizationStatusRestricted, kCLAuthorizationStatusDenied, kCLAuthorizationStatusAuthorized } CLAuthorizationStatus; 

The system will prompt the user to authorize your application if the authorization status is not defined when trying to start the location manager.

In addition, you can check the method of the locationServicesEnabled class to determine if location is enabled on the system.

+14
source

Optional - If locationServicesEnabled returns NO, and you still try to start location services, the system will prompt the user to confirm whether to reinstall location services.

+3
source

All Articles