Phonegap访问用户位置Info.plist

问题描述 投票:1回答:1

我有一个应用程序,它使用用户的位置来查找他们附近的地标。将我的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="[email protected]" href="http://phonegap.com">
        PhoneGap Team
    </author>
    <content src="index.html" />
    <access origin="*" />
</widget>

但是,由于这个原因,它仍然被拒绝。如何在iOS商店中修改config.xml或其他任何不被拒绝的原因?

location phonegap sharing info.plist
1个回答
2
投票

我删除了这部分:

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

现在它按预期工作了。

© www.soinside.com 2019 - 2024. All rights reserved.