9

Possible Duplicate:
Is it possible to call alert “Allow to use current location” manually?

in my app, all of the functionality is based on the users current location. The audience is everything else than geeky.

I think about the user starts the app for the first - as a user is not really sure about what it can do, s/he might be confused about the app's "Would Like to Use Your Current Location?" If he answers with "Don't allow", he won't get any data on the screen.

Now I handle:

- (void)locationManager:(CLLocationManager *)manager
   didFailWithError:(NSError *)error {

    if (error.code ==  kCLErrorDenied) {
        NSLog(@"Location manager denied access - kCLErrorDenied");

        UIAlertView *alert = 
              [[UIAlertView alloc] initWithTitle:@"Location issue" 
                                         message:@"Your location cannot be determined." 
                                        delegate:self 
                               cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert show];
        [alert release];
    } 
}   

Okay, the app has a Reload-Button. Assuming the user taps that reload button, he will not get asked again by the system to enable location based services.

How could I force iOS to ask for current location again?

Community
  • 1
  • 1
Chris Pillen
  • 810
  • 8
  • 27

2 Answers2

0

There is no way you could force this dialog to show again. iOS will ask the user again on the next start-up of the app. By start-up I do not mean entering the foreground after the app was sent to the background.

Rafał Sroka
  • 39,540
  • 23
  • 113
  • 143
0

Currently, the only fast way to do this is appears to be to ask the user to restart the app and then crash (or set the UIApplicationExitsOnSuspend key and launch Safari). When the user relaunches the app, the dialog will be available.

This may or may not get your app promptly rejected when Apple reviews it.

hotpaw2
  • 70,107
  • 14
  • 90
  • 153