I've submitted my app for review to the App Store Connect. Although the app is still under review, I've received an email to inform me that I have to fix an error. Here is the content of the message:
Dear Developer,
We identified one or more issues with a recent delivery for your app
XXXXX. Your delivery was successful, but you may wish to correct the
following issues in your next delivery:
"Missing Purpose String in Info.plist File. Your app's code
references one or more APIs that access sensitive user data. The
app's Info.plist file should contain a
NSLocationAlwaysUsageDescription key with a user-facing purpose
string explaining clearly and completely why your app needs the data.
Starting spring 2019, all apps submitted to the App Store that access
user data will be required to include a purpose string.If you're
using external libraries or SDKs, they may reference APIs that
require a purpose string. While your app might not use these APIs, a
purpose string is still required. You can contact the developer of
the library or SDK and request they release a version of their code
that doesn't contain the APIs.
After you’ve corrected the issues, you can use Xcode or Application
Loader to upload a new binary to iTunes Connect.
Best regards,
The App Store Team
My app is fully built with Expo and I don't know how to access and modify the Info.plist.
Any idea?
EDIT April 2019 : You now have to add these two keys, as spring 2019 has begun. Note that NSLocationAlwaysUsageDescription is now deprecated (since iOS 11) and has been replaced with NSLocationAlwaysAndWhenInUseUsageDescription and NSLocationWhenInUseUsageDescription. If you want to support lower than iOS 11, you'll have to use the three values.
To sum up you have to:
Add NSLocationAlwaysAndWhenInUseUsageDescription AND NSLocationWhenInUseUsageDescription for iOS 11 and more
And add NSLocationAlwaysUsageDescription if you want to support iOS 10 and less
And finally, you can add NSLocationUsageDescription if you wan to support iOS 8 and less.
You can submit your app even if you got this message !
I’ve just faced the same issue yesterday, even if the app isn’t using the location functionality. It may be related to some framework included in the project that have this optional feature.
I can confirm that my app has been approved even without the NSLocationAlwaysUsageDescription and NSLocationWhenInUseUsageDescription key in info.plist
Indeed, as Apple stated in the mail :
Starting spring 2019, all apps submitted to the App Store
that access user data will be required to include a purpose
string.
So the only thing to do is to add this key (right now is better, so that you won’t forget) in you project so that it will be included in your next update.
Just add two new entries in your info.plist, with NSLocationAlwaysUsageDescription and NSLocationWhenInUseUsageDescription as keys and a short description of why you use them as the value (even if you don’t really use them...).
If you're using Expo, you can add solve by adding infoPlist to app.json like so:
"expo": {
"ios": {
"bundleIdentifier": "com.app.myapp",
"infoPlist": {
"NSLocationAlwaysUsageDescription": "Some message to appease Apple.",
},
},
}
Expo Docs
I have some apps in the store and I tried to distribute a version for QA and the same thing happened in two different Apps.
I think this is a new criteria to accept the builds uploads to Appstore connect.
The solution is simple, add the following lines in the .plist file.
<key>NSLocationAlwaysUsageDescription</key>
<string>custom message</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>custom message</string>
PS: In my case have not using any feature of location, but I added these lines in order to comply with Appstore connect guidelines. Btw after receive that email, I could test the app even when they said that build it had some issues.
I hope this work for you guys.
It's a new requirement from apple, even if you do not use location. If you want to add the permissions in Xcode, look for "Privacy - Location Usage Description" and "Privacy - Location When In Use Usage Description" and type a custom string for each of them.
For more simplifying you can add these lines in your info.plist. These error are coming because Starting spring 2019, all apps submitted to the App Store that access user data will be required to include a purpose string.
Open info.plist as source code.
Add these following lines in your plist
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>$(PRODUCT_NAME) needs Location access for "some reason"!</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>$(PRODUCT_NAME) needs Location access for "some reason"!</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>$(PRODUCT_NAME) needs Location access for "some reason"!</string>
##Use this key in info.plist file
NSLocationAlwaysUsageDescription
Your location is required for xyz benefits for you NSLocationWhenInUseUsageDescription
Your location is required for xyz benefits for you
"Missing Purpose String in Info.plist File. Your app's code references one or more APIs that access sensitive user data. The app's Info.plist file should contain a NSLocationAlwaysUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data. Starting spring 2019, all apps submitted to the App Store that access user data will be required to include a purpose string.If you're using external libraries or SDKs, they may reference APIs that require a purpose string. While your app might not use these APIs, a purpose string is still required. You can contact the developer of the library or SDK and request they release a version of their code that doesn't contain the APIs.
Open Info.plist as source code.
Add these following lines in your plist
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>$(PRODUCT_NAME) needs Location access for "some reason"!</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>$(PRODUCT_NAME) needs Location access for "some reason"!</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>$(PRODUCT_NAME) needs Location access for "some reason"!</string>
We did receive the same email and we aren't using the CoreLocation at all. After a quick search, we found that Parse SDK could use CoreLocation. In Apple's email, they clearly say:
If you're using external libraries or SDKs, they may reference APIs that require a purpose string.
That mean the minute your code or any other Library or SDKs can use CoreLocation, even if you don't use it, you need to provide privacy description for "When In Use" and "Always Use".
It is also something new from Apple and for now it's only a warning but it will be required starting in Spring 2019 for new submissions.
There are the following cases:
NSLocationAlwaysAndWhenInUseUsageDescription (iOS>11)
NSLocationWhenInUseUsageDescription (iOS>11)
NSLocationAlwaysUsageDescription (iOS<=10)
NSLocationUsageDescription (seems very old, iOS8?)
Apple states at:
Add the NSLocationWhenInUseUsageDescription key and the NSLocationAlwaysAndWhenInUseUsageDescription key to your Info.plist file.
and:
If your app supports iOS 10 and earlier, add the NSLocationAlwaysUsage
NSLocationUsageDescription seems dead, the only ref in ADC site is:
https://developer.apple.com/ibeacon/Getting-Started-with-iBeacon.pdf
So to be sure, use first 3.
This issue is occurring because you haven't included
<NSLocationAlwaysUsageDescription>
for your app. I faced the same issue when I tried to submit my app on the AppStore. After the app was processed, I got the same mail. I just added the description and now its resolved.
Hope this helps.
These answers all tell you how to comply with the App Store rules to avoid the warning but the true fix would be for Expo to allow you to disable their SDKs requirement for Location Services unless you actually use them - I'm not sure if this is possible.
Please review the email you received from **App Store Connect **
Identify The Missing Key
Instructions
Open info.plist file.
Add and search for the missing key from the options provided (e.g. Contacts = Privacy - Contacts Usage Description)
Add Usage Description:
$(PRODUCT_NAME) needs Contacts access to "Provide The Reason Here".
Example:
same issue in Feb 19, got an email with a bunch of permissions I am not using, I assume they are from plugins. Apple says in March 19 it is a requirement so I am adding these in info.plst and uploading again.
It is very silly indeed.
I had
<key>NSLocationWhenInUseUsageDescription </key>
instead of
<key>NSLocationWhenInUseUsageDescription</key>
be sure to remove trailing whitespace
I also face the same issue but after 27 hours, I received the email about approved even I did nothing. So wait for approximately 24 hours instead of doing all this process again.
With Xcode 11 copy the key NSLocationAlwaysUsageDescription and add this to Info -> Custom iOS Target Properties -> Click + in the bottom left of this tab and as a value insert some kind of description like This app requires location access to function properly..
My app also got that, and I do nothing about it but it can run well ,next time I think should add such key in plist,just do some description
A short answer to the above problem -
NSLocationAlwaysUsageDescription must be updated with the following description in Info.plist file
{Your App Name} requires access to the location to suggest dengue
outbreak zones.
In our case, we were using NSLocationWhenInUseUsageDescription in our app, but not NSLocationAlwaysUsageDescription.
Reading from the comments here (thanks matt-oakes), it looks like NSLocationAlwaysUsageDescription is being used by one of the dependency frameworks we use.
Running our app it doesn't show the actual NSLocationAlwaysUsageDescription permission modal, so it looks to just handle this in the background.
So in summary, adding NSLocationAlwaysUsageDescription to the Info.plist fixed the warning email, and did not change any behaviour in the app 👍🏻
So I have a React Native app, and when testing in iOS, on first launch it always asks for location while in use (within 1 second of opening). ie. "Allow XXX to access your location while you are using the app?" permission dialog.
I am using react-native-permissions for other stuff, but I've searched and searched my code and have 0 references to "geolocation","location","navigator",etc. Basically there no location code or geolocation code anywhere to be found.
Looking for help on how to diagnose this crazy issue. In my NPM modules, again nothing crazy there either that would depend on location. I've even deleted the "NSLocationWhenInUseUsageDescription" from info.plist and app still launches, doesn't crash and never prompts location dialog!
(This is on iOS 11.3)
Looking for advice.
Thanks
Check your Info.plist, you probably have either of these keys, or both:
NSLocationAlwaysAndWhenInUseUsageDescription
NSLocationAlwaysUsageDescription
As a result iOS will prompt for location access as soon as you launch your app.
I'm working on a project where it's very often necessary to change the user's location, of course I included all the necessary data to simulate the location from the very beginning of the project. Today Xcode does not pretend to be a custom location, I decided to try to simulate one of the standard locations (for example San Francisco), but when I launch the application on a real device, my real location is displayed on the real device. I tried to run the application on the simulator, but got the same result. I did a clean project, rebooted the real device (iPhone 7), rebooted Xcode but it did not give results. I read a few topics, but they all relate to the fact that the developers did not include the simulation of the location in the scheme. How can I fix this problem? Thank you.
Update: I've updated Xcode, now I'm using Version 9.1 (9B55), but this did not fix this bug. Sometimes (once a week approximately), Xcode refuses to simulate even standard locations from the list (for example San Francisco). Although the menu above the consoles shows that the location simulates.
Info.plist contains
<key>NSLocationWhenInUseUsageDescription</key>
<string>Turn On Location Services to allow App to show you Events near you.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Turn On Location Services to allow App to show you Events near you.</string>
<key>NSLocationUsageDescription</key>
<string>Turn On Location Services to allow App to show you Events near you.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Turn On Location Services to allow App to show you Events near you.</string>
Update 1: Xcode does not simulate the location only on a real device (iPhone 7), two weeks ago there was no such problem. When I call CLLocationManager to show an alert, this alert on the real device is not shown at all. I repeat, this problem does not always repeat, this can happen once a week, but no methods help to restore this possibility to a working state.
I got the same problem and here's my work around.
You know the Location Services is not working when you don't see the arrow on status bar when you request location. So just turn Location Services off and on again. I guess this is a bug.
Go to Phone Settings > Location Services... then turn it off and on.
Xcode > Debug > Location Simulation
Simulator > Debug > Location > Custom Location (this will take what you set from step 2.)
You should see the arrow on status bar when you request location. If not... try the steps again.
First of everything ... Warning! , read this (from apple):
You are required to include the NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUsageDescription keys in your app's Info.plist file. (If your app supports iOS 10 and earlier, the NSLocationAlwaysUsageDescription key is also required.) If those keys are not present, authorization requests fail immediately.
Anyway, i just suggest make a simple test.
Make sure that you set Allow Location Simulation on the Run Scheme for your Debug Build Configuration on your target-
Run your App, switch to the Map app on simulator (is is the rfirst time you use, make sure you accept allow location dialog). -
Change the location on the location icon on Xcode (see below), and check that the map move to that location-
If everything is ok, the map app must show selected location
If your app is not able to follow same behaviour, maybe you are missing something. Further reading:
About Location Services and Maps
CoreLocation Framework Reference
Cheers.
I am developing an app with Cordova for iOS which includes geolocation functionalities (I use the official plugin https://github.com/apache/cordova-plugin-geolocation). I saw in options of my app that location access can be either set as "Never" or "While Using the App". However some other apps may also the option "Always" as shown in the attached screenshot. I would like to know whether it is possible to also have the option "Always" for Cordova-based applications.
Thanks!
I was using both NSLocationWhenInUseUsageDescription and NSLocationAlwaysUsageDescription in my company's Cordova app and it was working. Then, in late 2017, it stopped.
The fix for me has been to add also NSLocationAlwaysAndWhenInUseUsageDescription.
More broadly speaking, note that you need to have a plugin allowing to track location in background as well as make sure that the necessary background mode option is enabled in XCode.
We use the following plugin to do the job:
https://www.npmjs.com/package/cordova-plugin-lents-background-geolocation
This type of plugin is necessary as iOS stops execution of scripts for apps roughly 3 minutes after the display is turned off, regardless of the app foreground/background condition when the display was turned off. This prevents any JavaScript code to run and therefore any GPS tracking based on setInterval or setTimeout will stop working.
I guess "NSLocationAlwaysUsageDescription" key is the one which you are looking for. Check out this link which details the settings to be done in cordova based applications to have constant location access.
I'm using Ionic 2 and had to add the following to my App-Info.plist file. Even though cordova inserts 'NSLocationAlwaysUsageDescription' and 'NSLocationWhenInUseUsageDescription' keys. This only gave a 'Never' and 'While Using App' option on launch. Xcode suggested using the option below and that worked for me.
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>This app requires background location tracking</string>
Does anyone have experience using cordova, html and know how to fix this geolocation message issue for iOS? I just want the message to say the app name followed by the line, "would like to use your current location."
Current Geolocation Message:
///Users/kklsndksjladn/Library/Developer/CoreSimulator/Devices/FAF7EE4C-40BA-430A-80D5-5C84B07D970D/data/Containers/Bundle/Application/DAE305B6-C6DD-438B-B4D7-9B183A8B2D97/HelpME.app/www/index.html
I've tried various solutions from stack overflow and other websites. I implemented the navigator.geolocation.getCurrentPosition(onSuccess, onError); code, included my cordova.js file in every html page, made sure <script> src=cordova.js</script> appears first in my index.html page, included the geolocation tag in my config.xml file and tried playing around with my plist. Someone please help!!!!
-Thanks
In addition to the answer from DaveAlden, I had to remove the old version of the geolocation plugin and add the new one. Then I had to remove/add the Cordova iOS platform. Only then could I add NSLocationWhenInUseUsageDescription to the .plist file with success.
First, remove/add the geolocation plugin:
cordova plugin rm org.apache.cordova.geolocation
cordova plugin add org.apache.cordova.geolocation
Second, remove/add the iOS platform:
cordova platform rm ios
cordova platform add ios
Last, add NSLocationWhenInUseUsageDescription to the .plist. Open /platforms/ios/{project}/{project}-Info.plist and add the following:
<key>NSLocationWhenInUseUsageDescription</key>
<string>[App Name] would like to access your location when running and displayed.</string>
See this iOS Developer Library link for detailed information regarding NSLocationWhenInUseUsageDescription versus NSLocationAlwaysUsageDescription versus NSLocationUsageDescription.
Location permission alert on iPhone with Cordova is a possible duplicate.
To customise the iOS location permission request message, you need to add a property to your project's .plist.
If your app requests permission to use location in the background, you want the following key (set the string value to anything you like):
<key>NSLocationAlwaysUsageDescription</key>
<string>My app requires constant access to your location, even when the screen is off.</string>
If your app only uses location while in the foreground, then add the following key:
<key>NSLocationWhenInUseUsageDescription</key>
<string>My app requires access to your location when the screen is on and the app is displayed.</string>