NSLocationWhenInUseUsageDescription警告但我已经添加了它

Moh*_*med 16 location info.plist userlocation ios swift

虽然我已经添加了

NSLocationWhenInUseUsageDescription

我一直收到这个警告

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

仅供参考:我在应用程序中有多个info.Plist.不知道该怎么办?

Kar*_*amy 21

添加两者

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>
Run Code Online (Sandbox Code Playgroud)


Ant*_*hko 21

有大量结构不佳的框架(即 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>
Run Code Online (Sandbox Code Playgroud)


Tom*_*ran 9

嗯,实际上,在我的情况下,我需要像这样放置所有三个:

<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>...</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>...</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>...</string>
Run Code Online (Sandbox Code Playgroud)

否则,我不会收到要求允许该位置的弹出警报。 在此处输入图片说明

注:我是用Flutter开发的,不知道这种情况有没有影响……


Moh*_*med 5

我正在请求授权

viewDidLoad

如下:

self.locationManager.requestWhenInUseAuthorization()
Run Code Online (Sandbox Code Playgroud)

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