Time for action – configuring iWebInspector for iOS debugging
In order to debug an Apache Cordova/PhoneGap app using iWebInspector, you have to perform the following steps:
Find the application:didFinishLaunchingWithOptions method in the AppDelegate.m file.
Add the following snippet of code inside the method (it works with iOS 5 and greater):
Class class = NSClassFromString(@"WebView");
[class performSelector: @selector(_enableRemoteInspector)];
Once added the snippet creates a build.
Run the app in the emulator.
Use iWebInspector to load the app and play with the debug tools as you do when developing for the browser.
What just happened?
The app can be inspected as an HTML page; you can use all the browser debug techniques when emulating the app.
Debugging with weinre
With the acronym weinre (WEb INspector REmote) developers refer to a debugger for web pages, such as Firebug (for Firefox) and Web Inspector (for WebKit-based browsers), except it's designed to work remotely, and in particular, to allow you debug web pages on a mobile device.