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

cordovaiosxcode

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.

Best Answer

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

Related Topic