缺少Cordova Info.plist NSCameraUsageDescription键 [英] Cordova Info.plist NSCameraUsageDescription key is missing

查看:1202
本文介绍了缺少Cordova Info.plist NSCameraUsageDescription键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近更改后,如果您的应用尝试访问隐私敏感数据,则Apple需要特定密钥。所以我在我的config.xml中添加了NSCameraUsageDescription键,如下所示:

After recent changes Apple requires specific keys if your app attempts to access privacy-sensitive data. So I added NSCameraUsageDescription key in my config.xml like this:

<platform name="ios">
    <config-file parent="NSCameraUsageDescription" target="*-Info.plist">
        <string>We are using a camera to </string>
    </config-file>
</platform>

然后

cordova build ios --release --device

产生的ipa显然没有在info.plist中有正确的信息。感觉我错过了什么。

produces the ipa which apparently doesn't have the right info in info.plist. It feels like I'm missing something.

问题1:
我需要将什么内容放入config.xml来解决NSCameraUsageDescription问题?
问题2:
是否可以对此字符串使用本地化?

Question 1: What do I need to put into config.xml to solve NSCameraUsageDescription issue? Question 2: Is it possible to use localization for this string?

谢谢!

推荐答案

新答案:

从Cordova CLI 6.5.0开始,您可以写入 info.plist 直接使用 config.xml中的 edit-config 标记像这样:

Since Cordova CLI 6.5.0 you can write in the info.plist directly by using the edit-config tag in the config.xml like this:

< edit-config target =NSCameraUsageDescriptionfile =* - Info.plistmode = 合并 >
< string>您的使用信息< / string>
< / edit-config>

但请确保您使用的是最新版本的插件,否则插件变量可能会覆盖这些值。

<edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge"> <string>your usage message</string> </edit-config> But make sure you are using latest version of the plugins or values might be overwritten by the plugin variables.

对于本地化,您可以使用此插件中的资源文件标记和InfoPlist.strings文件(但您不需要插件,资源文件标记受支持config.xml)

For localizations you can use the resource-file tag and InfoPlist.strings files like in this plugin (but you don't need the plugin, resource-file tag is supported from the config.xml)

https ://github.com/MBuchalik/cordova-plugin-ios-permissions

OLD ANSWER:

OLD ANSWER:

您无法使用<$ c $从 config.xml 写入 info.plist c> config-file 标签(正在处理)

You can't write on the info.plist from the config.xml using the config-file tag yet (it's being worked on)

最新版本的相机插件允许你添加 NSCameraUsageDescription 安装插件时

Latest version of the camera plugin allows you to add the NSCameraUsageDescription when you install the plugin

cordova插件添加cordova-plugin-camera --variable CAMERA_USAGE_DESCRIPTION =您的使用信息

现在无法将此字符串本地化

Right now it's not possible to localize this string

这篇关于缺少Cordova Info.plist NSCameraUsageDescription键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆