Where is console.log output in Xcode?

2,856 views
Skip to first unread message

dbottillo

unread,
Mar 29, 2011, 7:30:39 AM3/29/11
to phonegap
Hi to everyone,

i'm a Sencha developer and i'm trying to get a working version of my
sencha app inside Phonegap
i read several tutorials about PhoneGap and now i want to write my
first SenchaPhonegap App

the first problem that i found, it's about console.log

i wrote a simple app like:


<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8">
<title>Demo</title>

<script type="text/javascript" src="phonegap.0.9.4.min.js"></script>

<script type="text/javascript">
alert(console.log);
alert("something");
console.log("something again");
alert("finish test console");
</script>
</head>
<body> Hello world! </body>

so it' very simple, without using Sencha
pure HTML and javascript

if i try to run this code with xcode (open console with Shift Command
R)...i obtain [native code] for first alert (correct), then another
alert with 'something' (correct) and then 'finish test console' inside
another alert (correct)
but in Xcode console i didn't see anything, i would expect 'something
again' inside console

so why console.log doesn't work?
it's very important that console.log works, because sencha source use
this call when display an error...so it's fundamental for debugging a
sencha app!!

I'm using phonegap0.9.4
i read on internet that i have to use debug.log, but i obtain the same
result with debug.log...!

Thank you

Daniele

Michael Herger

unread,
Mar 30, 2011, 2:39:17 AM3/30/11
to phon...@googlegroups.com
Check the xcode console (Run/Console).

Please note that I've had a hard time trying to debug code using
console.log(), as this call itself caused tons of problems. I _think_ this
is going to be addressed in PhoneGap 0.9.5, but with 0.9.4 several
console.log() statements called after each other could have caused
crashes.

The roadmap (http://wiki.phonegap.com/w/page/28291160/roadmap-planning)
has a bullet point "JS to Native support for multiple/overlapping
callbacks" which might address this.

Michael


--

Michael

dbottillo

unread,
Mar 30, 2011, 5:34:45 AM3/30/11
to phonegap
As i wrote, if i go to run->console i didn't see anything about
'console.log', what i see is:



2011-03-30 11:17:04.862 Master[3164:2003] void
SendDelegateMessage(NSInvocation*): delegate
(webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:) failed
to return after waiting 10 seconds. main run loop mode:
kCFRunLoopDefaultMode
2011-03-30 11:17:05.884 Master[3164:207] Device initialization:
DeviceInfo = {"name":"iPhone
Simulator","uuid":"3DBA6CEC-7325-5B43-8D3F-805930196688","platform":"iPhone
Simulator","gap":"0.9.4","version":"4.2"};
2011-03-30 11:17:05.912 Master[3164:207] Free space is 73652461568
2011-03-30 11:17:06.992 Master[3164:207]
PhoneGapDelegate::shouldStartLoadWithRequest: Received Unhandled URL
about:blank


So no trace about console.log :/
i have to wait phonegap 0.95??
is possibile that people is writing sencha app with phonegag without
log? is quite impossibile to work without!!

Thank anyway for your response

Daniele

On 30 Mar, 08:39, "Michael Herger" <s...@herger.net> wrote:
> Check the xcode console (Run/Console).
>
> Please note that I've had a hard time trying to debug code using  
> console.log(), as this call itself caused tons of problems. I _think_ this  
> is going to be addressed in PhoneGap 0.9.5, but with 0.9.4 several  
> console.log() statements called after each other could  have caused  
> crashes.
>
> The roadmap (http://wiki.phonegap.com/w/page/28291160/roadmap-planning)  
> has a bullet point "JS to Native support for multiple/overlapping  
> callbacks" which might address this.
>
> Michael
>

Michael Herger

unread,
Mar 30, 2011, 6:22:15 AM3/30/11
to phon...@googlegroups.com
> So no trace about console.log :/
> i have to wait phonegap 0.95??
> is possibile that people is writing sencha app with phonegag without
> log? is quite impossibile to work without!!

I've done most of the development in desktop Safari and on Android.

--

Michael

dbottillo

unread,
Mar 30, 2011, 6:57:02 AM3/30/11
to phonegap
My app is already working on safari and android with native desktop

the problem is that if i put my app directly inside phonegap it
doesn't work (blank page...)
so i think that there is some problem with this inclusion..
but without console.log (where Sencha framework puts errors), i can't
understand which point of my application it's not working

for this purpose i need that console.log works with phonegap!

Thank you

Daniele

Michael Herger

unread,
Mar 30, 2011, 7:22:00 AM3/30/11
to phon...@googlegroups.com
> the problem is that if i put my app directly inside phonegap it
> doesn't work (blank page...)

Get rid of all console.log() statements and try again...

--

Michael

friherd

unread,
Mar 30, 2011, 7:53:43 AM3/30/11
to phonegap
I use console.log lots in my apps. I don't use Sencha but do use
jQuery.

I've not had a problem using console.log nor have I ever suspected it
of causing a problem.
Reply all
Reply to author
Forward
0 new messages