---
title: "Remote Debugging UIWebView"
url: https://deallocatedobjects.com/posts/remote-debugging-uiwebview
author: Jake Marsh
published: 2011-12-06
updated: 2013-11-16
link: http://hiediutley.com/2011/11/22/debugging-ios-apps-using-safari-web-inspector/
topics: ["iOS Development", "Web", "Xcode & Tools"]
description: "Hiedi Utley has completely brought the awesome with a way to use desktop Safari’s WebKit inspector to debug iOS UIWebView objects: Wow! What a day!"
---

# Remote Debugging UIWebView

By Jake Marsh, December 6, 2011. HTML: https://deallocatedobjects.com/posts/remote-debugging-uiwebview

This is a link post about http://hiediutley.com/2011/11/22/debugging-ios-apps-using-safari-web-inspector/

[Hiedi Utley](https://twitter.com/#!/hiediutley/) has completely brought the awesome with a way to use desktop Safari's WebKit inspector to debug iOS `UIWebView` objects:

> Wow! What a day! While researching debugging techniques for an upcoming training class I am teaching on PhoneGap, I stumbled over a couple of blogs about a private API in iOS5 that will allow you to debug your UIWebViews right inside desktop Safari using the Web Inspector!

Enabling the trick requires part of a private API in iOS 5, so don't ship it. It does seem to work great though, and it's pretty simple:

``` objc
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Uncomment to enable remote debugging
    [NSClassFromString(@"WebView") _enableRemoteInspector];

    return YES;
}
```

Then open up desktop Safari and head over to [http://localhost:9999](http://localhost:9999). It requires that you be running iOS 5 and running inside the iOS Simulator, but still, what a HUGE help.

(via [Mike Rundle](https://twitter.com/flyosity))

*Update:* Turns out [Nathan de Vries](https://twitter.com/#!/atnan) did a lot of the original research and discovery on this one, here's his original (and in-depth) write up of it: [Enabling Remote Debugging via Private APIs in Mobile Safari](https://web.archive.org/web/20111129160255/http://atnan.com/blog/2011/11/17/enabling-remote-debugging-via-private-apis-in-mobile-safari/)
