iOS11问题: 定位服务在iOS11系统上不能使用?

iOS11问题: 定位服务在iOS11系统上不能使用?

这里写图片描述

Q:我刚刚用iOS11 SDK重新构建了应用程序,发现定位服务现在根本不起作用。

原因:A:因为苹果现在增加了一项新的隐私保护功能 NSLocationAlwaysAndWhenInUseUsageDeion

并且原有的 NSLocationAlwaysUsageDeion 被降级为 NSLocationWhenInUseUsageDeion

想要达到之前 NSLocationAlwaysUsageDeion 的定位效果,需要在info.plist文件中添加 NSLocationAlwaysAndWhenInUseUsageDeionNSLocationWhenInUseUsageDeion 两个就可以了。否则,徒劳无功,你的App依旧不支持Always authorization。

你在使用这个新Key时,位置服务可能仍然不起作用,在我进一步的搜索之后,发现这个gem与所有其他的调试信息混杂在一起:

这个App在没有usage deion的情况下能访问敏感隐私数据。App的info.plist必须包含NSLocationAlwaysAndWhenInUseUsageDeionNSLocationWhenInUseUsageDeion keys中使用字符串值向用户解释该应用如何使用这些数据

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

这与更新CLLocationManager.h文件中的注释有很大矛盾。

查看plist权限可以看到新增:

这里写图片描述

解决办法:

添加新Key NSLocationAlwaysAndWhenInUseUsageDeion和旧Key NSLocationWhenInUseUsageDeion的时候,定位服务就能正常使用了.


iOS开发者交流群:①446310206 ②446310206

你可能感兴趣的:(iOS11,iphone-x,iOS开发实战,IOS实用开发技巧,韩俊强的博客,iOS开发技术分享,Swift学习笔记,ios,iOS11,苹果,iphone-x,iOS11定位失败)