Bring up the “App Would Like to Use Your Current Location” dialogue again [duplicate]

我们两清 提交于 2019-12-05 22:04:26

问题


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?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/8480075/bring-up-the-app-would-like-to-use-your-current-location-dialogue-again

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!