Tiago Ramos
Posts: 0
Joined: Thu Feb 27, 2014 3:00 pm

Adding 3rd party phonegap plugins to iOS

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?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Adding 3rd party phonegap plugins to iOS

Hi Tiago,

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

Tiago Ramos
Posts: 0
Joined: Thu Feb 27, 2014 3:00 pm

Adding 3rd party phonegap plugins to iOS

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

Tiago Ramos
Posts: 0
Joined: Thu Feb 27, 2014 3:00 pm

Adding 3rd party phonegap plugins to iOS

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.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Adding 3rd party phonegap plugins to iOS

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.

Tiago Ramos
Posts: 0
Joined: Thu Feb 27, 2014 3:00 pm

Adding 3rd party phonegap plugins to iOS

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

Tiago Ramos
Posts: 0
Joined: Thu Feb 27, 2014 3:00 pm

Adding 3rd party phonegap plugins to iOS

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.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Adding 3rd party phonegap plugins to iOS

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

Tiago Ramos
Posts: 0
Joined: Thu Feb 27, 2014 3:00 pm

Adding 3rd party phonegap plugins to iOS

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

Tiago Ramos
Posts: 0
Joined: Thu Feb 27, 2014 3:00 pm

Adding 3rd party phonegap plugins to iOS

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.

Return to “Issues”