IOS8下,百度地图无法定位解决办法

 
通过在论坛中搜索,找到解决办法,我只是论坛的搬运工。分享如下:
 
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];
    }
 
posted @ 2015-07-09 15:07  frounk  阅读(215)  评论(0)    收藏  举报