Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I integrate the PhoneGap debug console with CLI?

This page on the PhoneGap site http://docs.phonegap.com/en/3.3.0/guide_cli_index.md.html#The%20Command-Line%20Interface 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?

like image 896
Steve Avatar asked Dec 17 '13 21:12

Steve


2 Answers

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 http://docs.phonegap.com/en/3.3.0/guide_cli_index.md.html#The%20Command-Line%20Interface 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.

like image 105
Steve Avatar answered Nov 08 '22 03:11

Steve


If you have installed the plugin using CLI all you need to do is call console.log('whateverYouWant') in your javascript file and that will show up in the XCode console.

like image 30
whodeee Avatar answered Nov 08 '22 03:11

whodeee