Today I’ve faced the challenge to update the iOS plist of my Cordova project. When you are a “Native” developer it should sounds stupid but when you use Cordova it’s not straight forward. plist So after few hours I’ve found two pretty nice and so different solutions:

  • Cordova plugin
  • Cordova hook

Create simple (very simple!) plugin

See an example cordova-plugin-itunesfilesharing for enabling iTunes file sharing

File sharing (UIFileSharingEnabled) allows an application to expose its Documents directory to the user through iTunes. The user can then move files back and forth between their devices and their computers.

<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns=""

    <description>Cordova/PhoneGap plugin for enabling iTunes file sharing</description>
    <license>Apache 2.0 License</license>
    <platform name="ios">
        <config-file target="*-Info.plist" parent="UIFileSharingEnabled">

Or set the value on build using variable on cli:

<preference name="CALENDAR_USAGE_DESCRIPTION" default=" " />
<config-file target="*-Info.plist" parent="NSCalendarsUsageDescription">

By this way you can dynamically set value when adding plugin:

cordova plugin add cordova-plugin-calendar --variable CALENDAR_USAGE_DESCRIPTION="This app uses your calendar"

Find here a good example of usage

See section config-file of plugin.xml documentation for more details. And if you’d like to go further I recommend this good tutorial PhoneGap Lab: Using Plugins End to End.

Use Cordova Hook and plist npm package

Here’s a Node.js implementation of Cordova Hook using the plist NPM package:

var fs    = require('fs');     //
var plist = require('plist');  //

var FILEPATH = 'platforms/ios/.../...-Info.plist';

module.exports = function (context) {

    var xml = fs.readFileSync(FILEPATH, 'utf8');
    var obj = plist.parse(xml);

    obj.GDLibraryMode = 'GDEnterpriseSimulation';

    xml =;
    fs.writeFileSync(FILEPATH, xml, { encoding: 'utf8' });


Choose a hook type, and then add the hook to your config.xml file:

<platform name="ios">
    <hook type="after_prepare" src="scripts/my-hook.js" />


Victor Dias

Sharing mobile Experiences

Follow me