Search code examples
iphoneiosios6cllocationmanager

iphone ask for Current location permission again


Case: For current location, the user selected "Dont allow" on app install, so is there a way that I can ask again for the user location and trigger the native iphone alert for current location??

I seen some posts on stackoverflow but there are old, is there a solution now to call in new sdk or someone found a way,

Post referred: CLLocation ask again for permission


Solution

  • Unfortunately you can't do that. One thing you can do is to prompt the user to change the location settings.

    if (![CLLocationManager locationServicesEnabled]) 
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Location Service Disabled" 
                                                            message:@"To re-enable, please go to Settings and turn on Location Service for this app." 
                                                           delegate:nil 
                                                  cancelButtonTitle:@"OK" 
                                                  otherButtonTitles:nil];
            [alert show];
    }