Page 1 of 3

Adding 3rd party phonegap plugins to iOS

Posted: Fri Apr 25, 2014 4:50 pm
by Tiago Ramos

I've managed to add 3rd party plugins to Android, but I'm having trouble doing the same with iOS.

For android, I followed these steps to add the plugins:
Edit assets/www/files/resources/lib/cordova_plugins.js to add the plugins;
Add the .js files of the plugins to assets/www/files/resources/lib/plugins;
Edit res/xml/config.xml to add my plugins
Add the .java files in the appropriate packages

For iOS, I had trouble finding the equivalent folders from the ones above.
I found config.xml in the root of the project, and cordova_plugins.js in Resources/www/project/files/resources/lib, so I editted those;
I added the .js files to Resources/www/project/files/resources/lib/plugins
I couldn't figure out where the .c and .h files should go, so I added them to the root of the project and also the CordovaLibPlugins folder.

The .ipa compiles with no problem, but the plugin doesn't actually work. The .js seems to be called successfully, but when it tries to exec() the plugin, I get the error message "ERROR: Plugin 'EmailComposer' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml."

On config.xml I have it added as
code
<feature name="EmailComposer">
<plugin name="ios-package" value="EmailComposer"/>
</feature>
/code

Any ideas?


Adding 3rd party phonegap plugins to iOS

Posted: Fri Apr 25, 2014 5:35 pm
by Kateryna Grynko

Hi Tiago,

Take a look at here please: https://getsatisfaction.com/apperyio/...


Adding 3rd party phonegap plugins to iOS

Posted: Fri Apr 25, 2014 6:18 pm
by Tiago Ramos

I forgot I had asked about this already, but the posts in my previous question didn't really help me.


Adding 3rd party phonegap plugins to iOS

Posted: Fri Apr 25, 2014 6:59 pm
by Tiago Ramos

Mainly, my problem is that I don't really know for sure where I should be putting the .m and .h files.

Following the convention of other plugins that already come with appery, I've put them in "CordovaLibPlugins", where I added a folder named "com.phonegap.plugins.emailcomposer" and added the files for this particular plugin there.

I tried exporting the xCode project (which I'd really, really rather not have to do), and apparently this folder I created doesn't get added to the project at all.


Adding 3rd party phonegap plugins to iOS

Posted: Fri Apr 25, 2014 6:59 pm
by Kateryna Grynko

Tiago,

You need to place .m and .h files in an appropriate folders in IOS/appName/appName/Resources/www/project/files/lib/plugins

And make changes in config.xml (I suppose you did it).

Also add the needed JS files.


Adding 3rd party phonegap plugins to iOS

Posted: Fri Apr 25, 2014 7:06 pm
by Tiago Ramos

IOS/appName/appName/Resources/www/project/files/lib/plugins
So the same folder where I add the www folder with the .js files?


Adding 3rd party phonegap plugins to iOS

Posted: Fri Apr 25, 2014 7:28 pm
by Tiago Ramos

Based on what you've said, I have it set like this: Image

In my config.xml, I've tried both
code
<feature name="EmailComposer">
<param name="ios-package" value="EmailComposer"/>
</feature>
/code
and
code
<feature name="EmailComposer">
<param name="ios-package" value="com&#46;jcee&#46;plugins&#46;EmailComposer"/>
</feature>
/code

The .js works fine, but when it tries to exec() the plugin, it's still not finding it.


Adding 3rd party phonegap plugins to iOS

Posted: Fri Apr 25, 2014 7:56 pm
by Kateryna Grynko

Hi Tiago,

You specify a folder:code value="com&#46;jcee&#46;plugins&#46;EmailComposer"/code

But there is:codecom&#46;jcee&#46;plugins&#46;EmailComposer/code


Adding 3rd party phonegap plugins to iOS

Posted: Fri Apr 25, 2014 7:58 pm
by Tiago Ramos

I don't think I understand what you're saying.


Adding 3rd party phonegap plugins to iOS

Posted: Fri Apr 25, 2014 8:38 pm
by Tiago Ramos

Ah, I see the name is wrong in the config.xml now (you typed it the wrong way twice, very confusing :P). Will try changing that.