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];
}
这样可以解决大多数时的问题. 但是有些机型还是有问题.
NSLocationAlwaysUsageDescription=YES
NSLocationWhenInUseUsageDescription=YES
2.在调用百度SDK定位之前,先运行如下代码:
if ([[UIDevice currentDevice].systemVersion floatValue] >= 8) {
//由于IOS8中定位的授权机制改变 需要进行手动授权
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
//获取授权认证
[locationManager requestAlwaysAuthorization];
[locationManager requestWhenInUseAuthorization];
}
这样可以解决大多数时的问题. 但是有些机型还是有问题.