How to detect if a user says no to use my default location?
core-location, ios, iphone, objective-c
Solution
For that, you need to implement below delegate method:
- (void)locationManager:(CLLocationManager*)manager didFailWithError:(NSError*)error
{
if([error code]== kCLErrorDenied)
self.locationDenied = YES;
switch ([error code]) {
// "Don't Allow" on two successive app launches is the same as saying "never allow". The user
// can reset this for all apps by going to Settings > General > Reset > Reset Location Warnings.
case kCLErrorDenied:
[appDelegate showAllowGPSLocationView];
default:
break;
}
self.locationDefined = NO;
}
You can create method "showAllowGPSLocationView" in AppDelegate. And show view to user that, you need to access GPS location.
Hope it will resolve your issue.
Happy Coding!
Problem
Possible Duplicate: Determining if user has denied CoreLocation permission How would I go about detecting if a user says no to "use my default location" in an iOS app? I would like to present them with a different view controller depending on their choice. thanks