user3324565
user3324565

Reputation: 111

How do you modify a PhoneGap / Cordova plugin and rebuild for iOS with the modification?

I am using the Cordova Splash Screen plugin (http://plugins.cordova.io/#/package/org.apache.cordova.splashscreen) and there is a bug with the current plugin that is causing the app to constantly crash. It appears the bug is documented here (https://issues.apache.org/jira/browse/CB-7497) but has not yet been fixed in an update, although a workaround is provided.

How do I incorporate the workaround in my project as I am unfamiliar with how to create or modify Cordova plugins. I edited the code to include the workaround mentioned, but how do I get the plugin to recompile for the actual Cordova or iOS project with the changes to the code that were made? I am a beginning to this, so if someone can provide easy to understand instructions on how I would go about incorporate this modified plugin back into my project I would appreciate it.

Upvotes: 11

Views: 11275

Answers (3)

Kilian Perdomo Curbelo
Kilian Perdomo Curbelo

Reputation: 1348

If you are debugging or want to modify the plugin code for any reason (including the plugin.xml file), you should remove and add the platform again. All the plugin code will be deployed to the corresponding platform according to the xml file:

cordova platform remove ios
cordova platform add ios

Upvotes: 2

Michal Liďák
Michal Liďák

Reputation: 131

If you want to change a downloaded plugin locally, you have to modify the plugin source files that are already copied in the corresponding platform folder, in your case ios folder.

For example the path of a source file of the barcode scanner plugin on Android platform looks like this:

<appname>\platforms\android\src\com\phonegap\plugins\barcodescanner\BarcodeScanner.java

On the other hand, the web portion of the plugin is copied from the plugin installation folder every time you run build command, so you need to change it there. Example:

<appname>\plugins\phonegap-plugin-barcodescanner\www\barcodescanner.js

Upvotes: 13

Ved
Ved

Reputation: 2701

First you need to remove old plugin using CLI

cordova plugin remove org.apache.cordova.splashscreen

Then add another ver of plugin

cordova plugin add org.apache.cordova.splashscreen**

after installation build your project and run.

Upvotes: 4

Related Questions