Visual Studio Cordova 缺少 Info.plist 键
Visual Studio Cordova Missing Info.plist key
我正在使用 visual studio 开发 cordova 应用程序。
如果我使用 Xcode8 将我的应用程序上传到应用商店,我会收到以下错误邮件。
Missing Info.plist key - This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.
基于另一个 Whosebug 问题,我添加了插件 https://github.com/leecrossley/cordova-plugin-transport-security
并修改了 plugin.xml:
<platform name="ios">
<config-file target="*-Info.plist" parent="NSAppTransportSecurity">
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library.</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app does not require access to the microphone.</string>
<key>NSCameraUsageDescription</key>
<string>This app requires access to the camera.</string>
</dict>
</config-file>
</platform>
在我的 config.xml:
<plugin name="cordova-plugin-transport-security" version="0.1.2" src="C:\Users\xxx\cordova-plugin-transport-security-master\cordova-plugin-transport-security-master" />
之后我为 iOS 构建了应用程序并通过 xcode 上传了它。
但是错误依然存在
通过该更改,您正在编写 NSPhotoLibraryUsageDescription
和 NSAppTransportSecurity
中的其他 UsageDescriptions,它应该在根目录中。
如果你使用最新版本的cordova-plugin-media-capture,它已经有needed values
<preference name="CAMERA_USAGE_DESCRIPTION" default=" " />
<config-file target="*-Info.plist" parent="NSCameraUsageDescription">
<string>$CAMERA_USAGE_DESCRIPTION</string>
</config-file>
<preference name="MICROPHONE_USAGE_DESCRIPTION" default=" " />
<config-file target="*-Info.plist" parent="NSMicrophoneUsageDescription">
<string>$MICROPHONE_USAGE_DESCRIPTION</string>
</config-file>
<preference name="PHOTOLIBRARY_USAGE_DESCRIPTION" default=" " />
<config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
<string>$PHOTOLIBRARY_USAGE_DESCRIPTION</string>
</config-file>
该值为 $CAMERA_USAGE_DESCRIPTION
,因为它是从您从 CLI 安装插件时的变量中选取的。当您使用 Visual Studio 时,我认为您可以使用 config.xml 中的变量标签设置值。
变量标签应该在将使用它们的插件中:
<plugin name="cordova-plugin-media-capture" spec="~1.4.1">
<variable name="CAMERA_USAGE_DESCRIPTION" value="your camera usage message" />
<variable name="MICROPHONE_USAGE_DESCRIPTION" value="your microphone usage message" />
<variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="your photolibrary usage message" />
</plugin>
如果这不起作用,您可以继续使用修改后的插件,但将每个 UsageDescription 添加为单独的 config-file
标记,就像之前的代码一样。
我正在使用 visual studio 开发 cordova 应用程序。
如果我使用 Xcode8 将我的应用程序上传到应用商店,我会收到以下错误邮件。
Missing Info.plist key - This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.
基于另一个 Whosebug 问题,我添加了插件 https://github.com/leecrossley/cordova-plugin-transport-security
并修改了 plugin.xml:
<platform name="ios">
<config-file target="*-Info.plist" parent="NSAppTransportSecurity">
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library.</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app does not require access to the microphone.</string>
<key>NSCameraUsageDescription</key>
<string>This app requires access to the camera.</string>
</dict>
</config-file>
</platform>
在我的 config.xml:
<plugin name="cordova-plugin-transport-security" version="0.1.2" src="C:\Users\xxx\cordova-plugin-transport-security-master\cordova-plugin-transport-security-master" />
之后我为 iOS 构建了应用程序并通过 xcode 上传了它。
但是错误依然存在
通过该更改,您正在编写 NSPhotoLibraryUsageDescription
和 NSAppTransportSecurity
中的其他 UsageDescriptions,它应该在根目录中。
如果你使用最新版本的cordova-plugin-media-capture,它已经有needed values
<preference name="CAMERA_USAGE_DESCRIPTION" default=" " />
<config-file target="*-Info.plist" parent="NSCameraUsageDescription">
<string>$CAMERA_USAGE_DESCRIPTION</string>
</config-file>
<preference name="MICROPHONE_USAGE_DESCRIPTION" default=" " />
<config-file target="*-Info.plist" parent="NSMicrophoneUsageDescription">
<string>$MICROPHONE_USAGE_DESCRIPTION</string>
</config-file>
<preference name="PHOTOLIBRARY_USAGE_DESCRIPTION" default=" " />
<config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
<string>$PHOTOLIBRARY_USAGE_DESCRIPTION</string>
</config-file>
该值为 $CAMERA_USAGE_DESCRIPTION
,因为它是从您从 CLI 安装插件时的变量中选取的。当您使用 Visual Studio 时,我认为您可以使用 config.xml 中的变量标签设置值。
变量标签应该在将使用它们的插件中:
<plugin name="cordova-plugin-media-capture" spec="~1.4.1">
<variable name="CAMERA_USAGE_DESCRIPTION" value="your camera usage message" />
<variable name="MICROPHONE_USAGE_DESCRIPTION" value="your microphone usage message" />
<variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="your photolibrary usage message" />
</plugin>
如果这不起作用,您可以继续使用修改后的插件,但将每个 UsageDescription 添加为单独的 config-file
标记,就像之前的代码一样。