Jobayer
Jobayer

Reputation: 1231

IOS PhoneGap app rejected by App store becasue of cordova-plugin-geolocation

Apple App store has rejected my app & send this message We noticed that your app requests the user’s consent to access the location but does not clarify the use of this feature in the permission modal alert.

This app is developed using phonegap & we are accessing geolocation using a plugin named cordova-plugin-geolocation. They has also mentioned that apple can create problem & suggest to add following code

<edit-config target="NSLocationWhenInUseUsageDescription" file="*Info.plist" mode="merge">
     <string>need location access to find things nearby</string>
</edit-config>

I have added it like this & resubmit it again.

<plugin name="cordova-plugin-geolocation" spec="2.4.2" />
<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
    <string>need location access to find things nearby</string>
</edit-config>

But they have sent same feedback. Now what should I do to fix this issue?

Upvotes: 0

Views: 1390

Answers (3)

Christian Meichtry
Christian Meichtry

Reputation: 95

With PhoneGap Build this worked for me :

<gap:config-file overwrite="true" parent="NSLocationWhenInUseUsageDescription" platform="ios">
    <string>Your usage description</string>
</gap:config-file>

Better Answer : Edit (20.04.2018)

A much better solution is to use a more recent PhoneGap version in Build :

<preference name="android-minSdkVersion" value="15" />
<preference name="phonegap-version" value="cli-7.1.0" />

Now the <edit-config/> tag will be recognized by Build.

Upvotes: 1

jcesarmobile
jcesarmobile

Reputation: 53301

The problem is you are using an old version of the plugin that still uses variables for the usage descriptions, and the variables are overwriting the edit-config tag values with an empty value (the default one)

You have two options:

  1. Update the geolocation plugin to 3.0.0 or greater and use the edit-config tag as you are doing now.

  2. Set the usage description for Phonegap Build.

To set the usage descriptions for Phonegap Build you have to do it like this:

<plugin name="cordova-plugin-geolocation" spec="2.4.2">
   <param name="GEOLOCATION_USAGE_DESCRIPTION" value="I want to find stores nearby" />
</plugin>

This should work if you have <preference name='phonegap-version' value='cli-7.0.1' /> or newer (or if you don't have any phonegap-version set as it will use the latest as default)

Upvotes: 2

minux
minux

Reputation: 2784

Check in xcode projec generated by cordova if the NSLocationWhenInUseUsageDescription key really exists in Info.plist. Sometimes it happened that cordova build did not copy plugins config correctly and I had to write them by hand.

How Info.plist should look like

Upvotes: 1

Related Questions