虽然我已经添加了:
NSLocationWhenInUseUsageDescription
但我一直收到这个警告:
此应用程序尝试访问隐私敏感数据,但没有使用说明。应用程序的Info.plist必须包含一个NSLocationWhenInUseUsageDescription键,其字符串值解释应用程序如何使用此数据。
注意:我在应用程序中有多个Info.plist。 不知道该怎么办。
虽然我已经添加了:
NSLocationWhenInUseUsageDescription
但我一直收到这个警告:
此应用程序尝试访问隐私敏感数据,但没有使用说明。应用程序的Info.plist必须包含一个NSLocationWhenInUseUsageDescription键,其字符串值解释应用程序如何使用此数据。
注意:我在应用程序中有多个Info.plist。 不知道该怎么办。
在plist中添加
NSLocationAlwaysAndWhenInUseUsageDescription
和
NSLocationWhenInUseUsageDescription
这两个键解决了我的问题。
<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 foo@bar.baz</string>
否则,在传达使用细节和风险时要使用巧妙措辞,以使应用程序访问沙盒之外的任何内容,并教育用户审查权限的审核跟踪记录,以便不时地进行检查(就像任何人都会这样做一样)。值得庆幸的是,在最近(大约在iOS14左右),苹果向最终用户报告可疑活动,例如MapsMe始终在后台跟踪。我正在
viewDidLoad
中请求授权,具体如下:
self.locationManager.requestWhenInUseAuthorization()
当我移除了这一行,错误就消失了。