Cordova cordova.plugins is undefined on win8 but not on iOS

262 views Asked by At

I'm using the plugin fileopener2 and to use it, I must call cordova.plugins.fileopener2.open(...);

When I run this on iOS, everything works perfectly. However, when I run the app on win8, I get an error telling me that cordova.plugins is undefined. Also, I double checked that, after 'ondeviceready' is fired, I console.log the value of cordova.plugins and it indeed returns an undefined value. Can anyone point me as to how I can fix this issue?

2

There are 2 answers

0
kot09 On BEST ANSWER

For Cordova Windows8 applications (or all applications built with Visual Studio), if your plugin is a custom one (I would assume it's not part of the org.apache...), you have to manually add it. Go to the config file in your www through visual studio. You will see three tabs: Core/Custom/Installed. Go to Custom, go to your cordova project, then in the plugins, find your custom plugin and add the folder of the plugin and voila, it will work!

0
Chuck Lantz On

If you are running into a problem with the plugin not working for a specific platform but working correctly for other platforms, first verify the plugin supports that platform. If the platform is supported, you should contact the plugin author which can generally by done by filing an issue at their GitHub site.

Ex: https://github.com/pwlin/cordova-plugin-file-opener2/issues

Projects created using Visual Studio 2015 are standard Cordova CLI projects. They author may not have Visual Studio, but should be able to reproduce your problem using the command line if you provide them the Cordova version you used (4.3.0 is the default as of VS 2015 RC) and good repro code.