Steve Steve - 1 year ago 62
iOS Question

How do I integrate the PhoneGap debug console with CLI?

This page on the PhoneGap site tells us how to use CLI to download the debug console ($ cordova plugin add org.apache.cordova.console). However, I see no further steps on how to integrate it into an Cordova iOS app on an HTML page.

Where is the console information supposed to appear, in the Terminal window during a cordova emulate? In the Xcode console?

Do I need to add anything to config.xml?

Answer Source

For the benefit of others who come to this page, here are detailed instructions for the plugin.

Installing and using the PhoneGap/Cordova debug console plugin

As part of your debugging process, you may want to output your own messages in the console when certain code has been executed. The CLI page at tells of a debug console download.

  1. Navigate to your project's home directory and type in the terminal: cordova plugin add org.apache.cordova.console

  2. Add a console.log line in your index.html file:

    function onDeviceReady() { console.log("*** Device is ready! ***"); }

  3. Now let's view the console message in Xcode. Whenever you'll be running the app in Xcode, first type: cordova prepare

  4. Open the app in Xcode and do Product > Clean.

  5. If you can't see the console in Xcode, then View > Debug Area > Activate Console.

  6. Run the app in Xcode and watch your console message appear in Xcode's console.