Wednesday, January 30, 2013

quick hit on debugging mobile safari

When the iPhone first came out, there was no App Store, and Apple said developers should make webapps. Now, the debate between webapps and native apps will go on and on, but suffice it to say, sometimes developers will want to to code web apps that run on iOS devices, and sometimes platform-sepecific bugs will rear their ugly head.

Luckily the later versions of iOS have a great solution for this, at least for a developer who as a Mac; plug in the iPad or iPhone (even if it's not the usual one you synch to), fire up Safari on iOS, and then Safari on OSX. You may have enable the "Develop" menu if you haven't already, but then on that topbar menu you should see your device name, and a list of windows it can provide a console for. (As you select through the various available-to-debug menus you should see the corresponding window highlight in iOS Safari) You can then use that console window to view errors and do other DOM manipulation.

Going cross-device to debug is a pretty solid trick!

1 comment:

  1. This also works for UIWebViews in native apps, which is pretty frigging awesome.