如何处理位置管理器的"不允许"?

har*_*alb 17 iphone cllocationmanager didfailwitherror

我现在还没有想到这一点.

直到现在每当设备要求我使用位置更新时我都允许它.

但是现在我不允许它,位置管理器给我kclErrorDenied并且位置管理器在重新启动应用程序之前无法再次启动.

所以我的问题是,我应该给用户重新启动应用程序的消息,还是有解决方案再次开始使用位置管理器.

谢谢 .

The Error :
ERROR,Time,288787555.078,Function,"void CLClientHandleDaemonDataRegistration(__CLClient*, const CLDaemonCommToClientRegistration*, const __CFDictionary*)",server did not accept client registration 1
WARNING,Time,288787555.108,Function,"void CLClientHandleDaemonInvalidation(__CFMessagePort*, void*)",client 1308.0 has been disconnected from daemon
 locationManager:didFailWithError:] [Line 244] Error Denied :Error Domain=kCLErrorDomain Code=1 "Operation could not be completed. (kCLErrorDomain error 1.)"
Run Code Online (Sandbox Code Playgroud)

wil*_*lli 36

实施- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error.

- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error {
    NSMutableString *errorString = [[[NSMutableString alloc] init] autorelease];

    if ([error domain] == kCLErrorDomain) {

        // We handle CoreLocation-related errors here
    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:
            //...
            break;
        case kCLErrorLocationUnknown:
            //...
            break;
        default:
            //...
            break;
        }
    } else {
        // We handle all non-CoreLocation errors here
    }
}
Run Code Online (Sandbox Code Playgroud)

  • 不... @willi不正确.该应用程序将询问一次.第一次.您无法发起第二次许可请求.Apple要求用户知道(当他们点击"不允许"时)如果没有地理位置,您的程序将无法运行.如果需要,请告知用户重新启动应用程序.如果您的应用可以在没有它的情况下工作,那么请继续使用该应用.无论如何,您必须让用户知道或Apple不会批准您的应用.ps:他们*做*检查这个......所以做对了. (5认同)