美文网首页
关于地图定位

关于地图定位

作者: 星辰流转轮回 | 来源:发表于2016-05-05 13:55 被阅读22次
      之前用地图,没记得加什么字符,系统会自动弹出授权提示框,今天写的时候一直是定位失败,原工程没问题,但新写工程确实不行,so.逛论坛找到了答案:
    

    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];
    }

    原网站http://www.wahenzan.com/a/mdev/ios/2015/0107/1452.html

    相关文章

      网友评论

          本文标题:关于地图定位

          本文链接:https://www.haomeiwen.com/subject/inedrttx.html