NSLocationWhenInUseUsageDescription warning but i

2020-05-31 04:39发布

While I have already added:

NSLocationWhenInUseUsageDescription

I keep receiving this warning:

This app has attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSLocationWhenInUseUsageDescription key with a string value explaining to the user how the app uses this data

FYI: I have multiple Info.plist in the app. Not sure what to do.

5条回答
男人必须洒脱
2楼-- · 2020-05-31 05:15

I was requesting authorisation in

viewDidLoad

as follows:

self.locationManager.requestWhenInUseAuthorization()

when I removed this line the error disappeared.

查看更多
何必那么认真
3楼-- · 2020-05-31 05:15

There are a ton of poorly structured frameworks (namely FirebaseMessaging) that use camera and location for no benefit to the user. You should alert end user this functionality is NOT needed for your application and user must NOT grant app access to that parasite inside. What a sad, sad times we live in.

    <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</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>
查看更多
来,给爷笑一个
4楼-- · 2020-05-31 05:17

Adding both

NSLocationAlwaysAndWhenInUseUsageDescription

and

NSLocationWhenInUseUsageDescription

keys in plist solved my problem.

    <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>
查看更多
We Are One
5楼-- · 2020-05-31 05:19

Well, actually, in my case I needed to put ALL THREE of them like this:

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

Otherwise, I wouldn't get the pop-up alert asking to allow the Location. enter image description here

Note: I develop in Flutter, I don't know if it has any repercussions in this case...

查看更多
萌系小妹纸
6楼-- · 2020-05-31 05:34

remove the NSLocationWhenInUseUsageDescription from plist and run the application and add again and run the application again

查看更多
登录 后发表回答