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

3

11

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.

Cholecystotomy answered 5/1, 2015 at 21:32 Comment(2)
did you edit the changes from xcode? or how?Pontine
I am having the same issue here with another plugin, did you manage to rebuild the plugin?Tanguy
A
13

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
Aitch answered 13/7, 2015 at 13:10 Comment(0)
E
4

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.

Emigrant answered 6/1, 2015 at 4:48 Comment(1)
This works but is slightly painful - seems like there should be a way to re-deploy the plugin for test purposes?Vie
L
2

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
Lamdin answered 30/4, 2019 at 10:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.