简体   繁体   中英

Phonegap: output JS logs to XCode console

I am new in PhoneGap dev. (using cordova-2.5.0) Trying to output some logs to XCode console by Javascript in HTML. Any way can do this? (Console.log didn't work)

I am trying to use the PhoneGap Plugin called "CDVLogger". This line is executed after OnDeviceReady triggered:

cordova.exec(function(winParam) {}, function(error) {}, "Logger", "logLevel", ["LOG", "hello"]);

But not working, only JS error.

Could anybody help me on this?

Thanks a lot.

Use console.log(""); for displaying output on console in xcode

I don't have experience w/that plugin you're using but it's possible you're experiencing the change the PhoneGap team made with version 3.0 where the console logging functionality was removed from a new PhoneGap project - so by default no logging works with 3.0 project.

To get console logging working you have to install the official "Console" plugin to your project. After doing that all the console.log() calls in your javascript will be displayed in Xcode's console. Here's how to install the plugin via the command line interface (CLI):

phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git

See this page for full details on plugin mgmt...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM