天天看點

在IOS8下 baidumap 初始化時沒有 定位授權 提示

在工程檔案xxx-info.plist裡添加兩個字段

NSLocationWhenInUseUsageDescription String yes //當你打開app時使用,定位服務

NSLocationAlwaysUsageDescription  String yes//一直使用定位服務,不論是否打開

if([[UIDevice currentDevice].systemVersion floatValue] > 8)

{

    self.locationManager =[ [CLLocationManager alloc] init];

    [self.locationManager requestAlwaysAuthorization];

     [self.locationManager requestWhenInUseAuthorization];

}

locationManager必須是全局變量,當為局部變量是手動定位提示AlertView會一閃而過。