经过在论坛中搜索,找到解决办法,我只是论坛的搬运工。分享以下:
1.在info.plist中加入:
NSLocationAlwaysUsageDescription=YES
NSLocationWhenInUseUsageDescription=YES
2.在调用百度SDK定位以前,先运行以下代码:
if ([[UIDevice currentDevice].systemVersion floatValue] >= 8) {
//因为IOS8中定位的受权机制改变 须要进行手动受权
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
//获取受权认证
[locationManager requestAlwaysAuthorization];
[locationManager requestWhenInUseAuthorization];
}
|