Phonegap 访问用户位置 Info.plist

Phonegap access user location Info.plist

我有一个应用程序可以使用用户的位置来查找他们附近的地标。将我的 Phonegap 应用程序提交到 iOS 商店后,它被拒绝了,原因如下:

"We noticed that your app requests the user’s consent to access their location but does not clarify the use of the location in the applicable purpose string. Please revise the relevant purpose string in your app’s Info.plist file to specify why the app is requesting access to the user's location. You can modify your app's Info.plist file using the property list editor in Xcode."

我认为我已经通过将以下内容添加到我的 config.xml 文件来解决这个问题:

<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
        <string>The user's location is used to find the distance they are from certain landmarks.</string>
</edit-config>

config.xml:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.phonegap.myapp" version="1.0.10" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
    <name>MyApp</name>
    <preference name="android-targetSdkVersion" value="26"/>
    <description>
        A blank PhoneGap app.
    </description>
    <plugin name="cordova-plugin-whitelist" source="npm" spec="~1.2.1" />
    <plugin name="cordova-plugin-geolocation" spec="2.4.3" />
    <plugin name="cordova-plugin-x-socialsharing" spec="5.4.0" />
    <edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
        <string>The user's location is used to find the distance they are from landmarks.</string>
    </edit-config>
    <icon src="images/icon.png" />
    <icon height="40" platform="ios" src="images/icon40.png" width="40" />
    <icon height="76" platform="ios" src="images/icon76.png" width="76" />
    <icon height="120" platform="ios" src="images/icon120.png" width="120" />
    <icon height="152" platform="ios" src="images/icon152.png" width="152" />
    <icon height="1024" platform="ios" src="images/icon1024.png" width="1024" />
    <author email="support@phonegap.com" href="http://phonegap.com">
        PhoneGap Team
    </author>
    <content src="index.html" />
    <access origin="*" />
</widget>

但是,还是因为这个原因被拒了。我怎样才能修改 config.xml 或其他任何内容,以免因这个原因在 iOS 商店被拒绝?

我删除了这部分:

<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
        <string>The user's location is used to find the distance they are from certain landmarks.</string>
</edit-config>

并添加了这一部分:

<plugin name="cordova-custom-config" version="*"/>
<config-file overwrite="true" parent="NSLocationAlwaysUsageDescription" platform="ios" target="*-Info.plist"> <string>Your location is used to find how far you are from landmarks.</string> </config-file>
<config-file overwrite="true" parent="NSLocationWhenInUseUsageDescription" platform="ios" target="*-Info.plist"> <string>Your location is used to find how far you are from landmarks.</string> </config-file>

现在一切正常。