cordova 1.5.0 console.log no output on XCode debug console

2,244 views
Skip to first unread message

Shuduo Sang

unread,
Apr 3, 2012, 2:20:19 PM4/3/12
to phon...@googlegroups.com
I can see the console.log output on safari but no ouput on Xcode 4.3.2
debug console. Only text I can see like below

initialization: DeviceInfo = {"name":"iPad
Simulator","uuid":"XXXX-XXXX-XXXX-XXXX","platform":"iPad
Simulator","gap":"1.5.0","version":"5.1","connection":{"type":"wifi"}};

anyone can help or struggling on same thing?

Thanks,
Shuduo

Shazron

unread,
Apr 3, 2012, 2:52:55 PM4/3/12
to phon...@googlegroups.com
Wait for deviceready. I just confirmed it works on 1.5.0

> --
> You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com

Shuduo Sang

unread,
Apr 4, 2012, 12:32:48 AM4/4/12
to phon...@googlegroups.com
I did more investigation and found that console.log works in my
index.html file but does not work after I switch to another file by
window.location='another.html'. Since I have to organize my
application logic to different files, I do need log work to debug if I
can workaround it by any way.

Thanks,
Shuduo

Shazron

unread,
Apr 4, 2012, 12:38:40 AM4/4/12
to phon...@googlegroups.com
Yes, console.log will only work when the phonegap/cordova javascript
is loaded after waiting for deviceready, for each html file. If your
"another.html" didn't load the phonegap/cordova javascript,
console.log will not print to the Xcode console

Shuduo Sang

unread,
Apr 4, 2012, 1:01:08 AM4/4/12
to phon...@googlegroups.com
I put cordova.js in head section of another.html too. I guess it had
not been loaded again since it be loaded in index.html at first. Do
you have any idea how to force it reload or other way else to make
console.log work in other files?

Shuduo Sang

unread,
Apr 4, 2012, 8:44:53 AM4/4/12
to phon...@googlegroups.com
Still frustrated on that log does not work even I force cordova.js
reload with adding suffix parameter ?x=1. I have searched and found
many people suffering on it like
http://www.tumblr.com/tagged/phonegap?before=1328391069. Could anyone
from phonegap team give it higher priority?

Thanks,
Shuduo

Shazron

unread,
Apr 4, 2012, 4:46:28 PM4/4/12
to phon...@googlegroups.com
It works, there is something else wrong with your setup. I tried with
a new project and linked to a new index2.html file that printed to the
console log.

Shuduo Sang

unread,
Apr 5, 2012, 10:22:34 AM4/5/12
to phon...@googlegroups.com
You are right. I found the root cause that log don't work because of
jquery! Looks like jquery changed the way pages switch. After I remove
jquery javascript reference line, the log work perfectly. I will ping
jquery guys to see if they have solution or not. At least, I can
temporarily disable jquery to debug logic first.

Thanks,
Shuduo

Shuduo Sang

unread,
Apr 5, 2012, 1:23:32 PM4/5/12
to phon...@googlegroups.com
For more accurately, it's jQuery Mobile.

Shuduo Sang

unread,
Apr 5, 2012, 1:29:03 PM4/5/12
to phon...@googlegroups.com
I have done more investigation, actually console.log can work out
after switch page with jQueryMobile included but no deviceready event
in new page. Without jQueryMobile, each page can handle its
deviceready event respectively.
Reply all
Reply to author
Forward
0 new messages