Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating Cordova Plugin results in failed plugin

I'm running Cordova 3.4.1 and decided to update the one and only plugin I have, Console. I did based on the update to plugins dated April 23, 2014 ( http://cordova.apache.org/news/2014/04/23/plugins.release.html ).

Updating is done by first removing and then adding back the plugin. In other words:

cordova plugin rm org.apache.cordova.console
cordova plugin add org.apache.cordova.console

I then ran

cordova build

which does a lot of voodoo, after which I compiled and ran the app on iOS via Xcode. The result is this fail: every time my code calls console.log I get this error in the XCode debugger output

CDVPlugin class CDVLogger (pluginName: Console) does not exist.
ERROR: Plugin 'Console' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
 -[CDVCommandQueue executePending] [Line 158] FAILED pluginJSON = [
  "INVALID",
  "Console",
  "logLevel",
  [
    "LOG",
    "text i want to see"
  ]
]

Plainly the process of updating plugins is not working properly. How can fix this myself? And if I do will it effect any subsequent fix by the Cordova team?

FWIW: I repeated this process, tried an cordova platform update ios to no avail. I am loath to reinstall the entire thing given all the mysterious Xcode configuration and build stuff and hoping there's a simple fix...

like image 628
jeffg Avatar asked Feb 13 '23 01:02

jeffg


1 Answers

I diff'ed the project against an earlier version I'd kept that worked properly and came up with this fix:

In Xcode, under your Phonegap or Cordova project, select

Target -> Build Phases -> Compile Sources

Add your plugin into the list there, in this case CVLogger.m located in your file structure under "Plugins".

After this, the project compiles without error and the console plugin works. No need to reinstall and reconfigure your entire project for this...

like image 53
jeffg Avatar answered Feb 16 '23 02:02

jeffg