PDA

View Full Version : copy cordova plugins with build?



kodak
20 Oct 2013, 1:58 AM
Hi!

I have a ST2.3.0 app which uses 4 cordova plugins. They are working and I added them with the

cordova plugin add https://githubrepo
described here: http://cordova.apache.org/docs/en/3.0.0/guide_cli_index.md.html

However, when I build my App for native iOS... the cordova plugins get not copied to the plugin dir in the ios build folder.

When I copy them manually to my ios project it works, but I think they should be automatically copied...

Does anybody know where I can specify the plugins or whats missing here?

Thanks!

coolfish
20 Oct 2013, 10:46 AM
Hi, I'm curious what plugins you are using, as I'm having problems with getting plugins to work. Does running `cordova build` properly add the plugins? I see the plugins in my build folder, I just can't seem to get them to work! Clearly sencha app build native should call cordova build somewhere along the lines, ensuring that the plugins are copied.

kodak
20 Oct 2013, 12:32 PM
Hi, I'm curious what plugins you are using, as I'm having problems with getting plugins to work. Does running `cordova build` properly add the plugins? I see the plugins in my build folder, I just can't seem to get them to work! Clearly sencha app build native should call cordova build somewhere along the lines, ensuring that the plugins are copied.

Hi. Iam using:
Email Composer: https://github.com/katzer/cordova-plugin-email-composer
Social Share: https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin
and
InAppBrowser: http://cordova.apache.org/docs/en/3.0.0/cordova_inappbrowser_inappbrowser.md.html#InAppBrowser

I switched to my cordova dir ( /mySTproject/cordova ) and did:


cordova platform add ios
cordova plugin add http://github-repo/plugin...


and


sencha cordova init

before of course.

Then I build the project with


sencha app build native


I had to add the socialPlugin.js to my app.json but the other plugins just worked.

Then... and that is the step I want to automate:
I had to open the Xcode project and copy the plugins from ".../mySTproject/plugins/" into the plugin dir of Xcode.

The entries for the plugins should already be in the config.xml (Xcode):


<feature name="EmailComposer">
<param name="ios-package" value="APPEmailComposer" />
</feature>
<feature name="SocialSharing">
<param name="ios-package" value="SocialSharing" />
</feature>
<feature name="InAppBrowser">
<param name="ios-package" value="CDVInAppBrowser" />
</feature>


Hope that helps.

coolfish
20 Oct 2013, 10:28 PM
Hm, the cordova init you should do just the once when you first start the project, no? It creates the cordova directory? Are you on a Mac or Windows? When you add a plugin (with cordova plugin add repo), does cordova/plugins/ios.json get updated properly?

I'd try switching to your cordova directory, cordova add plugin someOtherPlugin, then cordova prepare ios, then cordova build, and see if the plugin was properly set up in the platform. If not, it's something with your cordova vs sencha touch. I've encountered a (known, open) bug when editing anything in myProject.xcode, cordova starts throwing syntax errors when trying to add/remove plugins, or do anything else for that matter.

brian.lai
25 Dec 2013, 9:44 PM
I ran into this the other day, you have to remove the ios platform, remove the plugins, then reinstall the plugins, then reinstall the ios platform.

use these commands in this order:

$ cordova platform rm ios
$ cordova plugin rm [yourplugins]
$ cordova plugin add [yourplugins]
$ cordova platform add ios

You should be good to go after that.

Brian