Cordova / PhoneGap Plugin Permission Settings for NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription in iOS 11 by adding a declaration to the Info.plist file
cordova plugin add cordova-plugin-ios-location-permissions --save
cordova plugin add https://github.com/niconaso/cordova-plugin-ios-location-permissions.git --save
On installation you can customise the prompts shown by setting the following variables on installation.
- LOCATION_WHEN_IN_USE_USAGE_DESCRIPTION for NSLocationWhenInUseUsageDescription
- LOCATION_ALWAYS_AND_WHEN_IN_USE_USAGE_DESCRIPTION for NSLocationAlwaysAndWhenInUseUsageDescription
- LOCATION_ALWAYS_USAGE_DESCRIPTION for NSLocationAlwaysUsageDescription
For example:
cordova plugin add cordova-plugin-ios-location-permissions --variable LOCATION_WHEN_IN_USE_USAGE_DESCRIPTION="your usage message" --variable LOCATION_ALWAYS_AND_WHEN_IN_USE_USAGE_DESCRIPTION="your usage message" --variable LOCATION_ALWAYS_USAGE_DESCRIPTION="your usage message" --save
For the changes to plugin.xml
to take effect, you must refresh the ios.json
file (inside the /plugin
folder):
$ cordova platform rm ios
$ cordova platform add ios
Applies to iOS 10/11 only.
[MIT License]