Reputation: 31
Is there any way to determine whether location services have been disabled for a specific app? The problem is that [CLLocationManager locationServicesEnabled] returns YES even if location services have been disabled for a specific app...
Upvotes: 3
Views: 5335
Reputation: 3240
If you're targeting iOS 4.2 and above, just use [CLLocationManager authorizationStatus]
It will return one of the following CLAuthorizationStatus
values which are basically just integers:
typedef enum {
kCLAuthorizationStatusNotDetermined = 0,
kCLAuthorizationStatusRestricted,
kCLAuthorizationStatusDenied,
kCLAuthorizationStatusAuthorized
} CLAuthorizationStatus;
Search the docs for "CLLocationManager" for more info.
Upvotes: 10
Reputation: 33345
When you implement the delegate for location manager, you should be implementing didFailWithError. In there you will get the appropriate error if the user did not allow access to location
Apple Documentation States:
If the user denies your application’s use of the location service, this method reports a kCLErrorDenied
error. Upon receiving such an error, you should stop the location service.
Upvotes: 5