虽然我已经添加了:
NSLocationWhenInUseUsageDescription
我不断收到此警告:
此应用程序试图在没有使用说明的情况下访问隐私敏感数据。应用程序的 Info.plist 必须包含一个 NSLocationWhenInUseUsageDescription 键,其中包含一个字符串值,向用户解释应用程序如何使用此数据
仅供参考:我的应用程序中有多个 Info.plist。不知道该怎么办。
同时添加
NSLocationAlwaysAndWhenInUseUsageDescription
和
NSLocationWhenInUseUsageDescription
plist 中的键解决了我的问题。
<key>NSLocationAlwaysUsageDescription</key>
<string>Your location is required for xyz benefits for you</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your location is required for xyz benefits for you</string>
有大量结构不良的框架(即 FirebaseMessaging) 使用相机和位置对用户没有任何好处。 您应该提醒最终用户您的应用程序不需要此功能,并且用户不得授予应用程序访问内部寄生虫的权限。 我们生活在多么悲伤、悲伤的时代。
<key>NSLocationAlwaysUsageDescription</key>
<string>Your location is not needed. This request has popped up due to a 3rd party framework used by the app in a context that does NOT need you to reveal you location. Do be sure to check audit trail for the location queries on ios 15 or later.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>You will get zero benefit allowing this app accessing your location. You should never see this alert. If you do alert technical support at [email protected]</string>
或者以其他方式巧妙地使用措辞来传达确切的用法和风险,让应用程序访问其沙箱之外的任何内容,并在审计跟踪中引导您的用户获得必须不时检查的权限(就像任何人都会去做)。值得庆幸的是,最近(大约 ios14),Apple 一直在后台向最终用户报告可疑活动,例如 MapsMe 跟踪。
我在
请求授权viewDidLoad
如下:
self.locationManager.requestWhenInUseAuthorization()
当我删除这一行时,错误消失了。
从 plist 中删除 NSLocationWhenInUseUsageDescription 并运行应用程序,然后再次添加并再次运行应用程序