【问题标题】:Phonegap access user location Info.plistPhonegap 访问用户位置 Info.plist
【发布时间】:2019-02-27 17:47:05
【问题描述】:

我有一个应用,它使用用户的位置来查找他们附近的地标。将我的 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 商店中因为这个原因而被拒绝?

【问题讨论】:

    标签: location phonegap sharing info.plist


    【解决方案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>
    

    现在它按预期工作了。

    【讨论】:

      猜你喜欢
      • 2011-06-08
      • 1970-01-01
      • 2018-03-02
      • 2012-04-16
      • 1970-01-01
      • 2021-01-30
      • 1970-01-01
      • 2012-12-30
      • 1970-01-01
      相关资源
      最近更新 更多