您的位置:首页 > 移动开发 > IOS开发

iOS9 定位服务启用

2015-11-03 20:44 239 查看
iOS9里启动定位服务,但CLLocationManagerDelegate里的,

-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation
*)newLocation fromLocation:(CLLocation *)oldLocation不被调用。
解决方法:
在info.plist里添加

<key>NSLocationAlwaysUsageDescription</key>
<string>请允许开启定位服务,以获取当前位置</string>

然后会弹出提示允许就可以了。
如果需要后台定位,则加上。if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0) {
_locationManager.allowsBackgroundLocationUpdates = YES;
}就可以了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息