该应用程序的Info.plist文件必须包含NSLocationAlwaysUsageDescription和NSLocationWhenInUseUsageDescription。

3
我在 iTunes connect 中构建 ipa 文件时遇到了问题。
通过 PhoneGap Build 构建 apk,如何解决这个问题?
我正在面临以下问题:
缺少 Info.plist 密钥 - 此应用程序尝试访问隐私敏感数据,而没有使用说明。该应用程序的 Info.plist 必须包含一个 NSLocationAlwaysUsageDescription 密钥, 其中包含一个字符串值,向用户说明该应用程序如何使用此数据。
缺少 Info.plist 密钥 - 此应用程序尝试访问隐私敏感数据,而没有使用说明。该应用程序的 Info.plist 必须包含一个 NSLocationWhenInUseUsageDescription 密钥, 其中包含一个字符串值,向用户说明该应用程序如何使用此数据。
4个回答

3

我已经尝试过这两个可行的解决方案。现在它正在运作。

 <plugin name="cordova-plugin-geolocation">
         <variable name="LOCATION_WHEN_IN_USE_DESCRIPTION" value="App would like to access the location." />
        <variable name="LOCATION_ALWAYS_USAGE_DESCRIPTION" value="App would like to access the location." />
 </plugin>

或者

<plugin name="cordova-custom-config" version="*"/>
<config-file overwrite="true" parent="NSLocationAlwaysUsageDescription" platform="ios" target="*-Info.plist"> <string>Allow the app to know your location</string> </config-file>
<config-file overwrite="true" parent="NSLocationWhenInUseUsageDescription" platform="ios" target="*-Info.plist"> <string>Allow the app to know your location</string> </config-file>

@PieroAlberto 谢谢! - Maheshvirus

2

只需将以下行添加到您的config.xml文件中:

<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
    <string>[Custom message to show to user]</string>
</edit-config>
<edit-config target="NSLocationAlwaysUsageDescription" file="*-Info.plist" mode="merge">
    <string>[Custom message to show to user]</string>
</edit-config>

1
这对我很有帮助。请按以下方式修改config.xml文件:
  1. 找到相机插件并更新:

    <plugin name="cordova-plugin-camera"> <variable name="CAMERA_USAGE_DESCRIPTION" value="用于做某事 1" /> <variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="用于做某事 2" /> </plugin>

  2. 立即添加 iOS 插件权限:

    <plugin name="cordova-plugin-ios-camera-permissions"> <variable name="CAMERA_USAGE_DESCRIPTION" value="用于做某事 1" /> <variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="用于做某事 2" /> </plugin>

  3. </widget> 标签之前的 config.xml 文件末尾添加以下内容:

    <platform name="ios"> <edit-config target="NSPhotoLibraryUsageDescription" file="*-Info.plist" mode="merge"> <string>用于将照片附加到帐户资料</string> </edit-config> <edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge"> <string>用于为帐户资料拍照</string> </edit-config> </platform>

希望这有所帮助。

0
请前往您的info.plist文件。创建两个新键-"privacy Location usage Description"和 "Privacy - Location When In Use Usage Description"。为它们分别设置字符串值,在您的应用程序请求位置访问时将显示这些值。如果您不给它们赋值,缺省字符串将是"ALLOW "your app name" access your location while using the app"。如果不创建这两个键,则无法弹出要求用户授予位置权限的窗口。
希望这能帮到您。下面是Xcode显示info.plist文件的快照链接: link to the snapshot

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接