简体   繁体   中英

How to change the location access description for an Ionic 2 iOS App? I'm using cordova geolocation plugin for my app

I tried changing in the AppName-Info.plist to the description I want but after the build it gets automatically replaced by the default one over below.

<key>NSLocationWhenInUseUsageDescription</key>
<string>$NSLocationWhenInUseUsageDescription</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>$NSLocationAlwaysUsageDescription</string>

I also tried removing the cordova geolocation plugin and reinstalling as

cordova plugin add https://github.com/apache/cordova-plugin-geolocation.git --variable GEOLOCATION_USAGE_DESCRIPTION="Allow location access for maps"

but still it doesn't change the description. What I still get on my app is $NSLocationWhenInUseUsageDescription as my description.

I'm a little late to this post but I came across it while searching for an answer to the same problem. I ended up adding the following code to my ionic project config.xml file and after building and testing I can confirm that this worked.

<config-file parent="NSLocationWhenInUseUsageDescription" platform="ios" target="*-Info.plist">
        <string>This app requires access to your location when the screen is on and the app is displayed to Lorem Ipsum. Your code here.</string>
    </config-file>

I also attached a picture showing where that bit of code went in terms of the rest of the file.

Location Permission Example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM