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

时间:2018-05-17 10:17:25

标签: ios cordova itunesconnect phonegap-build

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

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

这是我面临的问题

  

缺少Info.plist密钥 - 此应用尝试访问隐私敏感数据而不显示用法说明。该应用程序   Info.plist必须包含带有的NSLocationAlwaysUsageDescription键   字符串值,向用户解释应用程序如何使用此数据。

     

缺少Info.plist密钥 - 此应用尝试访问隐私敏感数据而不显示用法说明。该应用程序   Info.plist必须包含NSLocationWhenInUseUsageDescription键   使用字符串值向用户解释应用程序如何使用此数据。

4 个答案:

答案 0 :(得分: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 :(得分:1)

我尝试过这两种有效的解决方案。现在它正在运作

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

答案 2 :(得分:1)

这对我有用。修改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>

  4. 希望这有帮助。

答案 3 :(得分:1)

转到您的info.plist文件。创建两个新密钥-“ privacy位置用法说明”和“隐私-使用中的位置用法说明”。分别为它们提供相应的字符串值,当您的应用请求位置时会显示这些字符串值如果未给它们提供值,则默认字符串将为“允许”,您的应用程序名称”将在使用该应用程序时访问您的位置”。如果不创建这两个键,则不会弹出询问用户位置许可的弹出窗口。

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

link to the snapshot