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

17,719

Solution 1

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

Solution 2

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.

Share:
17,719
bbodien
Author by

bbodien

Front-end developer, product designer, prototyper/ist.

Updated on June 08, 2022

Comments

  • bbodien
    bbodien almost 2 years

    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.

  • Vinodh
    Vinodh almost 10 years
    you want me to add plugin config in root folder of WWW. am i right?