ios 如何解决“缺少 Info.plist 键...... NSPhotoLibraryUsageDescription”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41611987/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 11:02:52  来源:igfitidea点击:

How to resolve "Missing Info.plist key ... NSPhotoLibraryUsageDescription"

ioscordova

提问by Ale

I upload my .ipa file completely using application loader but i didn't find the built on Itunes Connect also i receive this message from apple support :"We have discovered one or more issues with your recent delivery for "Update HF". To process your delivery, the following issues must be corrected: 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. "

我完全使用应用程序加载程序上传了我的 .ipa 文件,但我没有找到内置于 Itunes Connect 的文件,我也收到了来自 Apple 支持的消息:“我们发现您最近的“更新 HF”交付存在一个或多个问题。要处理您的交付,必须更正以下问题: 缺少 Info.plist 键 - 此应用程序尝试访问隐私敏感数据而没有使用说明。该应用程序的 Info.plist 必须包含一个 NSPhotoLibraryUsageDescription 键,其中包含一个字符串值,向用户解释应用程序使用这些数据。”

i add the following codes to config.xml file but i still have the same error:

我将以下代码添加到 config.xml 文件中,但仍然出现相同的错误:

回答by Rahul Saini

enter image description hereYou can add below lines in your plist.

在此处输入图片说明您可以在 plist 中添加以下行。

<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) uses photos</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>$(PRODUCT_NAME) uses photos</string>

回答by jcesarmobile

EDIT: All core plugins have been updated to not use variables anymore. To set the usage descriptions you have to use edit-configtag in the config.xmllike this:

编辑:所有核心插件都已更新为不再使用变量。要设置使用说明,您必须像这样使用edit-config标签config.xml

<edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge">
    <string>need camera access to take pictures</string>
</edit-config>

See iOS Quirkssection

请参阅iOS 怪癖部分

OLD ANSWER: First remove the cordova-plugin-camera with cordova plugin rm cordova-plugin-camera

旧答案:首先删除cordova-plugin-camera cordova plugin rm cordova-plugin-camera

And then install it again with:

然后再次安装它:

cordova plugin add cordova-plugin-camera --variable PHOTOLIBRARY_USAGE_DESCRIPTION="your usage message"

回答by Lewis Edward Garrett

In my case App Store Connect kept saying that the key was missing even though it was certainly there. After looking at the Info.plist many times, I finally noticed that the NSPhotoLibraryUsageDescriptionkey had an extra space at the end of the key which, apparently, prevents the upload process from seeing the key.

就我而言,App Store Connect 一直说密钥丢失了,即使它确实存在。在多次查看 Info.plist 之后,我终于注意到NSPhotoLibraryUsageDescription键在键的末尾有一个额外的空间,这显然阻止了上传过程看到键。

 Here's a screenshot of the problem and solution:

 这是问题和解决方案的屏幕截图:

回答by TechSavvySam

I'm using VS TACO and this is how I finally resolved this issue. Edit the \plugins\fetch.json file so the "cordova-plugin-camera" adding the "variables" section:

我正在使用 VS TACO,这就是我最终解决此问题的方法。编辑 \plugins\fetch.json 文件,以便“cordova-plugin-camera”添加“变量”部分:

"cordova-plugin-camera": {
    "source": {
        "type": "registry",
        "id": "cordova-plugin-camera@~2.4.1"
    },
    "is_top_level": true,
    "variables": {
        "CAMERA_USAGE_DESCRIPTION": "your description text here",
        "PHOTOLIBRARY_USAGE_DESCRIPTION": "your description text here"
    }
}

回答by vishal rana

I encounter the same problem. Try using the below code in your config.xml

我遇到了同样的问题。尝试在 config.xml 中使用以下代码

<gap:config-file platform="ios" parent="NSPhotoLibraryUsageDescription">

This might be a late response for you but hope this works for people in future.

这对你来说可能是一个迟到的回应,但希望这对未来的人们有用。