17

我现在还没有想到这个。

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

但是,当现在我不允许时,位置管理器会给我 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.)"
4

1 回答 1

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
    }
}
于 2010-02-25T11:58:35.443 回答