我正在使用以下代码来更新位置 - 它在 iOS 9 下工作正常,但在 iOS 9 中出现错误 -
locationManager = [[CLLocationManager alloc] init];
[locationManager setDelegate:self];
[locationManager setDistanceFilter:kCLDistanceFilterNone];
[locationManager setDesiredAccuracy:kCLLocationAccuracyHundredMeters];
if ([locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)])
[locationManager requestWhenInUseAuthorization];
// tried this also -
/* if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9) {
locationManager.allowsBackgroundLocationUpdates = YES;}*/
[locationManager requestLocation];
didFailWithError: Error Domain=kCLErrorDomain Code=0 "(null)"
还对 plist
文件进行了更改 -
有人可以建议我缺少什么吗?
最佳答案
当位置要求键未添加到 Info.plist 时,此错误也会出现。
检查 Info.plist 中是否有以下键之一(带有 Bool 值):
NSLocationWhenInUseUsageDescription
NSLocationAlwaysUsageDescription
关于objective-c - iOS 9 - 位置更新出现错误 didFailWithError : Error Domain=kCLErrorDomain Code=0 "(null)",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31855733/