I am trying to add a custom Cordova plugin for the iOS platform, and I am having some issues when I compare that with the process to add a plugin on cordova.
The plugin I am trying to use here is https://github.com/phonegap-build/StatusBarPlugin
With cordova I used to simply use the command line cordova plugin add com.phonegap.plugin.statusbar
First, I tried to modify in native folder, but I noticed that If I do so, It works but It will be erased the next time I deploy again for iOS platform.
Second, I tried to add files (plugin js file and cordova_plugins.js file.) under apps/myapp/iphone, or apps/myapp/common, but this causes an issue : The cordova_plugins.js
file format seems to become not ok.
Instead of having this working format:
cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [
{
"file": "plugins/org.apache.cordova.battery-status/www/battery.js",
"id": "org.apache.cordova.battery-status.battery",
"clobbers": [
"navigator.battery"
]
},
,
{
"file": "plugins/com.phonegap.plugin.statusbar/www/statusbar.js",
"id": "com.phonegap.plugin.statusbar.statusbar",
"clobbers": [
"window.StatusBar"
]
}
]
});
It have this format that does not work properly :
/* JavaScript content from worklight/cordova_plugins.js in JS Resources */
/*
* Licensed Materials - Property of IBM
* 5725-I43 (C) Copyright IBM Corp. 2006, 2013. All Rights Reserved.
* US Government Users Restricted Rights - Use, duplication or
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [
{
"file": "plugins/org.apache.cordova.battery-status/www/battery.js",
"id": "org.apache.cordova.battery-status.battery",
"clobbers": [
"navigator.battery"
]
}
]
});
/* JavaScript content from worklight/cordova_plugins.js in folder common */
/* JavaScript content from worklight/cordova_plugins.js in JS Resources */
/*
* Licensed Materials - Property of IBM
* 5725-I43 (C) Copyright IBM Corp. 2006, 2013. All Rights Reserved.
* US Government Users Restricted Rights - Use, duplication or
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [
{
"file": "plugins/org.apache.cordova.battery-status/www/battery.js",
"id": "org.apache.cordova.battery-status.battery",
"clobbers": [
"navigator.battery"
]
},
{
"file": "plugins/com.phonegap.plugin.statusbar/www/statusbar.js",
"id": "com.phonegap.plugin.statusbar.statusbar",
"clobbers": [
"window.StatusBar"
]
}
]
});
How should I do? Where should I put these file? What is the proper way to add this custom plugin, especially if I want to add it only for iOS and not for Android?