1

我从这个链接关注 iOS 的核心数据教程 ,我的位置管理器似乎没有收到任何事件。我在模拟器上启用了定位服务,当我启动应用程序时,它会请求使用我的位置的权限,然后我说“好的”。知道为什么它没有拾取任何东西吗?

我的位置管理器委托方法如下所示返回以下错误:

2013-02-15 18:05:16.653 Locations[8280:c07] errorError Domain=kCLErrorDomain Code=0 “操作无法完成。(kCLErrorDomain 错误 0。)”

我什至尝试过调试 --> 模拟位置。顺便说一句,我正在使用 OSX Mountain Lion。

谢谢!

//location manager delegate method for fail
- (void)locationManager:(CLLocationManager *)manager
       didFailWithError:(NSError *)error {
    NSLog(@"Reached loc mngr delegate method 2...error occurred");
    [manager stopUpdatingLocation];
    NSLog(@"error%@",error);
    switch([error code])
    {
        case kCLErrorNetwork: // general, network-related error
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"please check your network connection or that you are not in airplane mode" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
            [alert show];
        }
            break;
        case kCLErrorDenied:{
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"user has denied to use current Location " delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
            [alert show];
        }
            break;
        default:
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"unknown network error" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
            [alert show];
        }
            break;
    }
    addButton.enabled = NO;
}
4

0 回答 0