首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >cordova ios项目中的<edit,xml的父标记是什么?

cordova ios项目中的<edit,xml的父标记是什么?
EN

Stack Overflow用户
提问于 2018-01-26 00:25:07
回答 2查看 5.6K关注 0票数 6

我更新了一个iOS应用程序,它在下面的电子邮件中被拒绝

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

我尝试将下面的xml标记添加到config.xml中。

代码语言:javascript
复制
<edit-config file="*-Info.plist" mode="merge" target="NSCameraUsageDescription">
    <string>Need camera access to take pictures</string>
</edit-config>
<edit-config file="*-Info.plist" mode="merge" target="NSPhotoLibraryUsageDescription">
    <string>Need to photo library access to get pictures from there</string>
</edit-config>

但是我不确定我需要在哪个标签下

我的config.xml文件.

代码语言:javascript
复制
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.aotsinc.christian.iphone.biblequizcompanion" version="3.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>Bible Quiz Companion</name>
    <description>
        Bible Quiz Companion is a free app useful for the users to prepare for Jounior Bible Quiz Compatition.
    </description>
    <author email="dev@cordova.apache.org" href="http://cordova.io">
        Alpha Omega Tech Solutions Inc.
    </author>
    <content src="index.html" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
        <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>
    <engine name="ios" spec="^4.5.4" />
    <plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
    <plugin name="cordova-plugin-x-socialsharing" spec="^5.2.1" />
    <plugin name="cordova-plugin-camera" spec="^4.0.1" />
    <plugin name="cordova-plugin-tts" spec="^0.2.3" />
    <plugin name="cordova-plugin-apprate" spec="^1.3.0" />
    <plugin name="com.darktalker.cordova.screenshot" spec="git+https://github.com/gitawego/cordova-screenshot.git" />
</widget>

谢谢你的帮忙

编辑1

我试图添加代码,您在plugin.xml中给相机插件如下所示。但我在info.plist中没有看到这个条目。你能告诉我plugin.xml里找的钱是否正确吗?谢谢

代码语言:javascript
复制
<platform name="ios">
         <config-file target="config.xml" parent="/*">
             <feature name="Camera">
                 <param name="ios-package" value="CDVCamera" />
             </feature>
             <preference name="CameraUsesGeolocation" value="false" />
         </config-file>

         <js-module src="www/ios/CameraPopoverHandle.js" name="CameraPopoverHandle">
            <clobbers target="CameraPopoverHandle" />
         </js-module>

         <preference name="CAMERA_USAGE_DESCRIPTION" default=" " />
          <config-file target="*-Info.plist" parent="NSCameraUsageDescription">
               <string>Need camera access to take pictures</string>
          </config-file>
          <preference name="PHOTOLIBRARY_USAGE_DESCRIPTION" default=" " />
          <config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
               <string>Need to photo library access to get pictures from there</string>
          </config-file>

         <header-file src="src/ios/UIImage+CropScaleOrientation.h" />
         <source-file src="src/ios/UIImage+CropScaleOrientation.m" />
         <header-file src="src/ios/CDVCamera.h" />
         <source-file src="src/ios/CDVCamera.m" />
         <header-file src="src/ios/CDVJpegHeaderWriter.h" />
         <source-file src="src/ios/CDVJpegHeaderWriter.m" />
         <header-file src="src/ios/CDVExif.h" />
         <framework src="ImageIO.framework" weak="true" />
         <framework src="CoreLocation.framework" />
         <framework src="CoreGraphics.framework" />
         <framework src="AssetsLibrary.framework" />
         <framework src="MobileCoreServices.framework" />
         <framework src="CoreGraphics.framework" />
         <framework src="AVFoundation.framework" />

     </platform>
EN

回答 2

Stack Overflow用户

发布于 2018-01-27 02:21:24

见文档

config.xml中作为<platform name="ios">的子节点添加:

代码语言:javascript
复制
<edit-config target="NSPhotoLibraryUsageDescription" file="*-Info.plist" mode="merge">
    <string>need to photo library access to get pictures from there</string>
</edit-config>
票数 3
EN

Stack Overflow用户

发布于 2018-01-26 08:00:33

在需要以下内容的插件的PLUGIN.XML文件中,在平台标记下面使用config- file 而不是编辑-config

代码语言:javascript
复制
<platform name="ios">
    <preference name="CAMERA_USAGE_DESCRIPTION" default=" " />
    <config-file target="*-Info.plist" parent="NSCameraUsageDescription">
         <string>Need camera access to take pictures</string>
    </config-file>
    <preference name="PHOTOLIBRARY_USAGE_DESCRIPTION" default=" " />
    <config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
         <string>Need to photo library access to get pictures from there</string>
    </config-file>
</platform>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48454081

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档