【问题标题】:The app's Info.plist must contain NSLocationAlwaysUsageDescription & NSLocationWhenInUseUsageDescription.应用的 Info.plist 必须包含 NSLocationAlwaysUsageDescription 和 NSLocationWhenInUseUsageDescription。
【发布时间】:2018-10-27 13:48:44
【问题描述】:

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

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

这是我面临的问题

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

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

【问题讨论】:

    标签: ios cordova app-store-connect phonegap-build


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

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

       <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 谢谢!
      【解决方案3】:

      这对我有用。修改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. 转到 &lt;/widget&gt; 标签之前的 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】:

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

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

        link to the snapshot

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2023-03-16
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2015-12-30
          相关资源
          最近更新 更多