【发布时间】:2013-07-02 13:04:00
【问题描述】:
我无法在设备上获取我的当前位置。它第一次正确显示,但第三次失败并显示此消息:
Error while getting core location : (null)
我的代码是:
CLLocationManager *manager;
manager = [[CLLocationManager alloc] init];
manager.pausesLocationUpdatesAutomatically=NO;
manager.delegate = self;//or whatever class you have for managing location
[manager startUpdatingLocation];
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
NSLog(@"in update location");
}
- (void)locationManager:(CLLocationManager *)manager
didFailWithError:(NSError *)error
{
NSLog(@"Error while getting core location : %@",[error localizedFailureReason]);
}
输出是:
2013-07-03 18:32:33.146 CLLocationUpdate[6084:907] in update location
2013-07-03 18:32:33.200 CLLocationUpdate[6084:907] in update location
2013-07-03 18:32:33.517 CLLocationUpdate[6084:907] in update location
2013-07-03 18:32:34.073 CLLocationUpdate[6084:907] in update location
2013-07-03 18:32:50.903 CLLocationUpdate[6084:907] Error while getting core location : (null)
请帮忙。 提前致谢。
【问题讨论】:
-
你能打印error.localizedDescription吗?
-
操作无法完成。 (kCLErrorDomain 错误 0。)
标签: iphone ios objective-c core-location cllocationmanager