10
votes

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.

3

3 Answers

13
votes

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

3
votes

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.

0
votes

Very straightforward solution that worked for me: downgrade Cordova CLI version to earliest one that doesn't erase ios.json during build.

My case: CLI version was 5.4.1, upgraded to 6.3.1 - fail. Downgraded to 6.2.0 - OK

One downside is that you need to test CLI versions manually.