最近項目中用到了百度地圖定位 發現IOS8+的真機測試並無辦法定位 應該是百度本身的問題測試
1. 在info.plist中加入如下兩個屬性:
NSLocationAlwaysUsageDescription=YES
NSLocationWhenInUseUsageDescription=YESspa
2. 在調用百度地圖定位以前,加上以下代碼:code
1 if ([[UIDevice currentDevice].systemVersion floatValue] >= 8) { 2 3 CLLocationManager *locationManager = [[CLLocationManager alloc] init]; 4 5 [locationManager requestAlwaysAuthorization]; 6 [locationManager requestWhenInUseAuthorization]; 7 8 }