我正在尝试支持iOS7和8位置服务。当我在iOS8设备上运行时,出现以下错误:
"MyApp depending on legacy on-demand authorization, which is not supported for new apps"
我的plist中有一个使用中的条目。这是我的代码:
if ([_locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
[_locationManager requestWhenInUseAuthorization];
} else {
[_locationManager startUpdatingLocation];
}
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
if (status == kCLAuthorizationStatusAuthorizedWhenInUse) {
[_locationManager startUpdatingLocation];
}
}
为什么会出现此错误?
我正在从位置服务实现不推荐使用的回调,而没有实现新的回调。没有编译器警告,但是阅读此警告的开发人员应检查其代码中的位置服务委托文档。
不推荐使用,这是委托文档中的第一个方法。整个问题都是RTFM的一个例子。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句