我有一个应用程序,它使用用户的位置查找他们附近的地标。将我的Phonegap应用提交到iOS应用商店后,由于以下原因,该应用被拒绝了:
”“我们注意到您的应用请求用户同意访问其位置,但未在适用的目的字符串中明确说明该位置的用途。请修改您应用的Info.plist文件中的相关目的字符串,以指定为什么使用该应用正在请求访问用户的位置。您可以使用Xcode中的属性列表编辑器来修改应用的Info.plist文件。“
我认为我已经通过将以下内容添加到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商店上被拒绝?
答案 0 :(得分:1)
我删除了这部分:
<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>
现在它可以正常工作了。