繁体   English   中英

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

[英]The app's Info.plist must contain NSLocationAlwaysUsageDescription & NSLocationWhenInUseUsageDescription.

我在 iTunes Connect 中构建 ipa 文件时遇到问题。

如何解决这个问题我正在通过 PhoneGap Build 构建 apk。

这是我面临的问题

缺少 Info.plist 键 -此应用程序尝试访问隐私敏感数据而没有使用说明。 应用程序的 Info.plist 必须包含一个 NSLocationAlwaysUsageDescription 键和一个字符串值,向用户解释应用程序如何使用这些数据。

缺少 Info.plist 键 -此应用程序尝试访问隐私敏感数据而没有使用说明。 应用程序的 Info.plist 必须包含一个 NSLocationWhenInUseUsageDescription 键和一个字符串值,向用户解释应用程序如何使用这些数据。

我已经尝试过这两个工作解决方案。 现在它正在工作

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

只需将这些行添加到您的 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>

这对我有用。 修改config.xml如下:

  1. 找到相机插件并更新:

    <plugin name="cordova-plugin-camera"> <variable name="CAMERA_USAGE_DESCRIPTION" value="Used to do something 1" /> <variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="Used to do something 2" /> </plugin>

  2. 在此之后立即添加 IOS 插件权限:

    <plugin name="cordova-plugin-ios-camera-permissions"> <variable name="CAMERA_USAGE_DESCRIPTION" value="Used to do something 1" /> <variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="Used to do something 2" /> </plugin>

  3. </widget>标记之前转到 config.xml 文件的末尾并添加:

    <platform name="ios"> <edit-config target="NSPhotoLibraryUsageDescription" file="*-Info.plist" mode="merge"> <string>Used to attach photos to account profile</string> </edit-config> <edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge"> <string>Used to take pictures for account profile</string> </edit-config> </platform>

希望这可以帮助。

转到您的 info.plist 文件。创建两个新键 - “隐私位置使用说明”和“隐私 - 使用时的位置使用说明”。给它们各自的字符串值,当您的应用请求位置访问时,这些值将显示出来。您不给它们值默认字符串将是“允许“您的应用程序名称”在使用应用程序时访问您的位置”。如果不创建这两个键,您将不会收到询问用户位置权限的弹出窗口。

希望这会有所帮助。下面是显示 info.plist 文件的 xcode 快照。

快照链接

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM