Inspect UIWebView with Safari

My friend Matthew Sinclair pointed out a neat trick recently. When embedding a UIWebView into an app, it's often useful to be able to inspect the contents of that view.

First, go to Settings -> Advanced and turn on the "Develop menu" in Safari.

develop menu

Then, with the simulator running, go to the Develop menu and choose the simulator.

simulator

It'll open up the Safari Inspector and give you access to the UIWebView.

It's often a good idea to mix in web views into your native screens where appropriate. Web views are fast to develop and, as long as you don't need to interact with them too much, seem just like native views. This gives you a few more tools to work with them.