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

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

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

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

这是我面临的问题

Missing Info.plist key - This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSLocationAlwaysUsageDescription key with a string value explaining to the user how the app uses this data.

Missing Info.plist key - This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSLocationWhenInUseUsageDescription key with a string value explaining to the user how the app uses this data.

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

我已经尝试过这两个可行的解决方案。现在可以使用了

 <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如下:

  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. 转到 config.xml 文件末尾 </widget> 标记之前并添加:

    <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 file.create 两个新键 - “隐私位置使用说明”和“隐私 - 使用时的位置使用说明”。为它们提供相应的字符串值,这些值将被显示当你的应用程序请求位置时 access.IF 你不给它们值默认字符串将是“允许”你的应用程序名称“在使用应用程序时访问你的位置”。如果不创建这两个键,你将不会弹出询问用户位置权限。

希望这个 helps.Below 是显示 info.plist 文件的 xcode 的快照。

link to the snapshot