View Full Version : IOS 6 Web Inspector

13 Dec 2012, 9:37 AM
IOS 6 comes with a wonderful remote debugging tool, Web Inspector, that runs when one enables the option on your iPhone5. It works great with safari web apps on the phone or iPad however I do not see how to use it to debug an issue when I run Phonegap/Sencha 2.0 app as I do not see a way to have the debugger running when I start the app. The option Safari/Develop/Iphone only shows up AFTER the app is running on the phone. was wondering if anyone has had sucess in using this tool with Phonegap. I suspect the problem is that my app is now native and not a true web app.

15 Dec 2012, 7:16 AM
That's just how the remote debugger works in iOS6

15 Dec 2012, 1:39 PM
actually you are not quite right as I found a way to accomplish my goal by accident. If your answer was correct then Web Inspector would be useless but the opposite is true as it is a great tool!

One way is to put an alert at the start of your app.js so that the lanched app is paused then attach the debugger and happy days! The other more elegant way that was pointed out to me on the Phonegap forum was to run the app from XCode, let it run and display the white screen, then attach the Safari Web Inspector and in the log window enter the command 'window.location.reload() '

I must add that these techniques apply as well to a Sencha Native app .

15 Dec 2012, 2:25 PM
ok, a workaround to the issue not really how to use it as the alert() will just stop any JS execution.

15 Dec 2012, 3:20 PM
but that is the point as now you attach the web inspector and debug the app. without the alert you cannot pause the execution. The window.location.reload is a prefered solution and I use the word solution as this approach gives you a great debugging experience on IOS.