Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

How cordova plugins work in ionic 2?

$
0
0

I asked a question yesterday regarding the usage of cordova plugins. I solved the problem by creating my project from scratch. But when I add a new plugin again. The new plugin doesn't work although the old plugin still work. Here are my steps:

  • Create a new project

ionic start myproject blank --v2

  • Add the social share plugin

cordova plugin add cordova-plugin-x-socialsharing

  • Add my code related to social sharing and build it for ios

ionic platform add ios
cordova prepare
cordova build ios

  • Run xcode in my device. It works well
  • Add a new plug for InAppBrowser

cordova plugin add cordova-plugin-inappbrowser

  • Add my code related to InAppBrowser and build

cordova prepare
cordova build ios

Then I got an error message like:

ORIGINAL EXCEPTION: TypeError: undefined is not an object (evaluating 'ionic_1.cordova.InAppBrowser')

But my social share plugin still work!!! It looks like the new plugin is not hooked up to my project at all.

If I start a new project and add plugin for InAppBrowser, everything is fine. So it's not the problem of plugin itself. Can anybody help to explain how ionic 2 hook up the plugin to project? Why can't add new plugin? Thanks.


Viewing all articles
Browse latest Browse all 228595

Trending Articles