iOS Current Location Usage Description in Cordova

smartphone Gps App New York

Providing a clear location usage description is critical to have your iOS app approved. With the default settings of the Apache Cordova location plugin cordova-plugin-geolocation, your app is likely to be rejected by Apple. I experienced this first hand with the iOS version of the Farmers Market app. Apple reviewers sent me the following message:

Guideline 5.1.1 – Legal – Privacy – Data Collection and Storage

We noticed that your app requests the user’s consent to access their location, but does not clarify the use of this feature in the permission modal alert.

To address the problem, I had to change the config.xml file at the root folder of the Cordova project. I have added the following to customize the location permission request on iOS. It sets the value of the entry Privacy - Location When In Use Usage Description in the plist of the xCode project.

<edit-config file="*-Info.plist" mode="merge" target="NSLocationWhenInUseUsageDescription">
    <string>Farmers Market wants to get your location to find nearby markets. Your location is kept secrete in your smartphone.</string>
</edit-config>

CREDITS: Photo by Enrique Alarcon on Unsplash

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.