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?
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.
Navigate to your project's home directory and type in the terminal:
cordova plugin add org.apache.cordova.console
Add a console.log line in your index.html file:
function onDeviceReady() {
console.log("*** Device is ready! ***");
}
Now let's view the console message in Xcode. Whenever you'll be running the app in Xcode, first type:
cordova prepare
Open the app in Xcode and do Product > Clean.
If you can't see the console in Xcode, then View > Debug Area > Activate Console.
Run the app in Xcode and watch your console message appear in Xcode's console.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With