iOS开发 iOS11获取定位权限失败的解决方法

1,964 阅读1分钟

6:关于iOS11定位失效的问题解决方案

This app has attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain both NSLocationAlwaysAndWhenInUseUsageDescription and NSLocationWhenInUseUsageDescription keys with string values explaining to the user how the app uses this data

具体原因是苹果原来的永久定位权限已经下降为使用期间 需要新增如下两个权限, NSLocationAlwaysAndWhenInUseUsageDescription 和 NSLocationWhenInUseUsageDescription 在plist文件中添加这两个就可以了。

    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string>允许访问位置</string>