經過在論壇中搜索,找到解決辦法,我只是論壇的搬運工。分享以下:
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];
}
|