NSLocationWhenInUseUsageDescription 警告,但我已经添加了

问题描述 投票:0回答:5

虽然我已经添加了:

NSLocationWhenInUseUsageDescription

我不断收到此警告:

此应用程序试图在没有使用说明的情况下访问隐私敏感数据。应用程序的 Info.plist 必须包含一个 NSLocationWhenInUseUsageDescription 键,其中包含一个字符串值,向用户解释应用程序如何使用此数据

仅供参考:我的应用程序中有多个 Info.plist。不知道该怎么办。

ios swift location info.plist userlocation
5个回答
68
投票

同时添加

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>

30
投票

有大量结构不良的框架(即 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 跟踪。


19
投票

好吧,实际上,就我而言,我需要将它们全部三个像这样放置:

<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>...</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>...</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>...</string>

否则,我不会收到要求允许该位置的弹出警报。

注意:我在Flutter中开发,我不知道在这种情况下是否有任何影响...


5
投票

我在

请求授权

viewDidLoad

如下:

self.locationManager.requestWhenInUseAuthorization()

当我删除这一行时,错误消失了。


0
投票

从 plist 中删除 NSLocationWhenInUseUsageDescription 并运行应用程序,然后再次添加并再次运行应用程序

© www.soinside.com 2019 - 2024. All rights reserved.