Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the Parent Tag for <edit-config in config,xml in cordova ios project?

I update an iOS app and it was rejected with below email

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.

I try to add below xml tag to 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>

But I am not sure under which tag I need to

My config.xml file.

<?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="[email protected]" 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>

Thanks for your help

EDIT 1

I try to add the code that you gave in plugin.xml inside camera plugin as below. But I didn't see this entry in the info.plist. Can you please tell me whether my change in the plugin.xml is correct. Thanks

<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>
like image 930
Augustine Joseph Avatar asked Jan 26 '18 00:01

Augustine Joseph


People also ask

What are the elements in config xml file of Cordova?

The name of the app that we specified when creating the app. Description for the app. Author of the app. The app's starting page.

Where is config xml in Cordova?

The Cordova config. xml file is the global configuration file of the application. The Cordova configuration file is a mandatory XML file that contains application metadata, and is stored in the root directory of the app.

How do I add a plugin to config xml Cordova?

When adding plugins or platforms, use the --save flag to add them to config. xml. Ex: cordova platform add android --save. Existing projects can use cordova plugin save and cordova platform save commands to save all previously installed plugins and platforms into your project's config.

Where can I find config xml?

Each WebLogic Server domain contains a central configuration file called the config. xml, which is stored in the DOMAIN_HOME\config directory. Both the Admin Server and the Managed Servers derive their run-time configuration information from the config.


2 Answers

see docs

In your config.xml as a child node of <platform name="ios"> add:

<edit-config target="NSPhotoLibraryUsageDescription" file="*-Info.plist" mode="merge">
    <string>need to photo library access to get pictures from there</string>
</edit-config>
like image 117
johnborges Avatar answered Oct 21 '22 07:10

johnborges


Use config-file instead of edit-config below PLATFORM tag in PLUGIN.XML file of your plugin that need this:

<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>
like image 24
Frix33 Avatar answered Oct 21 '22 08:10

Frix33