Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova iOS Plugins fail after building, unless I remove platform and plugin JSON first

Tags:

xcode

ios

cordova

I have a Cordova 3.2.0 project, and I'm testing using the XCode emulator and an iPhone 4S over USB.

When I execute the following, the app runs without error:

rm -rf platforms/ios
rm plugins/ios.json
cordova platforms add ios
cordova build ios

If I then make any kind of change to my code, and re-run:

cordova build ios

I get the following errors when launching the app in XCode:

ERROR: Plugin 'StatusBar' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml. 2013-12-02 10:50:26.136 treemedia[774:60b] -[CDVCommandQueue executePending] [Line 127] FAILED pluginJSON = [ "INVALID", "StatusBar", "_ready", [ ] ]

ERROR: Plugin 'Device' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml. 2013-12-02 10:50:26.140 treemedia[774:60b] -[CDVCommandQueue executePending] [Line 127] FAILED pluginJSON = [ "Device1738472658", "Device", "getDeviceInfo", [ ] ]

ERROR: Plugin 'NetworkStatus' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml. 2013-12-02 10:50:26.143 treemedia[774:60b] -[CDVCommandQueue executePending] [Line 127] FAILED pluginJSON = [ "NetworkStatus1738472659", "NetworkStatus", "getConnectionInfo", [ ] ]

In order to run the app without errors, I have to remove the platform and plugin json file, then re-add the ios platform and rebuild. If I skip those steps and just rebuild, these errors occur every time.

This has only started happening since updating Phonegap/Cordova to 3.2.0 from a slightly earlier version.

like image 723
bbodien Avatar asked Dec 02 '13 10:12

bbodien


2 Answers

In XCode, goto Build Phases -> open the Compiled Sources dropdown. Click + and add the missing plugin .m file that should be in your Plugins directory (but is missing from the compiled sources).

This solution came from another stack overflow answer, here: https://stackoverflow.com/a/21148428/80254

like image 142
bjunix Avatar answered Oct 11 '22 20:10

bjunix


I seem to have resolved this by modifying the config.xml file that exists in the "www" subdirectory of the project.

With a clean build from scratch, Cordova seems to generate the config.xml file under "platforms/ios" with the plugin feature tags (perhaps inferring their use from the presence of the plugin files themselves), but on rebuilding then those get lost.

By having them explicitly defined in the www/config.xml path, the rebuilds work fine.

like image 35
bbodien Avatar answered Oct 11 '22 19:10

bbodien