首页 文章

由于cordova-plugin-geolocation,IOS PhoneGap应用程序被App Store拒绝

提问于
浏览
0

Apple App Store拒绝了我的应用并发送此消息 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.

这个应用程序是使用phonegap开发的,我们使用名为 cordova-plugin-geolocation 的插件访问地理位置 . 他们还提到苹果可以创建问题&suggest添加以下代码

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

我已经像这样添加了它并重新提交它 .

<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>

但他们发出了同样的反馈 . 现在我该怎么做才能解决这个问题?

3 回答

  • 1

    问题是您使用的旧版本插件仍然使用变量作为用法描述,并且变量用空值覆盖 edit-config 标记值(默认值)

    您有两种选择:

    • 将地理定位插件更新为3.0.0或更高版本,并像现在一样使用 edit-config 标记 .

    • 设置Phonegap Build的使用说明 .

    要设置Phonegap Build的使用说明,您必须这样做:

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

    如果您有 <preference name='phonegap-version' value='cli-7.0.1' /> 或更新(或者您没有设置任何phonegap版本,因为它将使用最新的默认设置),这应该有效

  • 2

    如果Info.plist中确实存在 NSLocationWhenInUseUsageDescription 密钥,请检查cordova生成的xcode项目 . 有时它发生了cordova构建没有正确复制插件配置,我不得不手工编写它们 .

    How Info.plist should look like

  • 1

    使用PhoneGap Build,这对我有用:

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

    Better Answer : Edit (20.04.2018)

    更好的解决方案是在Build中使用更新的PhoneGap版本:

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

    现在,Build将识别 <edit-config/> 标记 .

相关问题