什么是<edit-config in =“”config的父标记,xml =“”in =“”cordova =“”ios =“”project?=“”

时间:2018-01-26 00:25:08

标签: ios cordova cordova-plugins cordova-plugin-camera

=“”

我更新了一个iOS应用,但它被拒绝了,发送电子邮件

  

缺少Info.plist键 - 此应用尝试访问隐私敏感   没有使用说明的数据。应用程序的Info.plist必须包含   NSPhotoLibraryUsageDescription键,其字符串值解释为   用户应用程序如何使用此数据。

我尝试将以下xml标记添加到config.xml。

<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文件。

<?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中的更改是否正确。感谢

<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>

2 个答案:

答案 0 :(得分:3)

see docs

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

<edit-config target="NSPhotoLibraryUsageDescription" file="*-Info.plist" mode="merge">
    <string>need to photo library access to get pictures from there</string>
</edit-config>

答案 1 :(得分:2)

在您的 PLUGIN.XML 文件中的 PLATFORM 标记下使用配置文件代替 edit-config 需要这个的插件:

<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>
相关问题