Under the Bridge

A PonyDebugger For Princess Coders

So there you were squealing “DADD-EE, I want a PONY for my debugging!” and why look what those super helpful folk over at Square have come up with for you:

PonyDebugger: Remote Debugging Tools for Native iOS Apps

PonyDebugger is a remote debugging toolset that operates as a client library and gateway server combination using Chrome Developer Tools on a web browser to debug an application’s network traffic and data store. We began by implementing an iOS client library to debug our application’s network traffic sent via NSURLConnection and its Core Data stack. To get started, check out the GitHub repository.

Improved network traffic debugging is always handy, although our QA department has been managing to get by with Charles, but wait, what? “And its Core Data stack?”

Core Data Browser

Another cool feature of PonyDebugger is its ability to remotely debug an iOS application’s Core Data stack. By registering managed object contexts, a user can browse all of their entities, properties and drill-down relationships through Chrome’s IndexedDB browser.

coredata-example.png

The great advantage is that it doesn’t require access to nor implementation of an SQLite data store. This means that browsing data is easy, whether through the Simulator or on a real device. There’s also no difference between tracking an in-memory object store or an object store that has a SQLite persistent store, as it interacts directly with an NSManagedObjectContext.

Woah. How does that work?

How It Works

The WebKit Web Inspector, which Chrome Developer Tools is heavily based on, implements a protocol that defines all of the commands, events and types that each debugger “domain” implements. For example, the network debugging feature is implemented by communicating events and commands with Inspector’s Network Domain protocol.

Chrome Developer Tool’s Remote Debugging API exposes and documents (part of) its API for developers to communicate their own data to its developer tools application. We created an iOS client that implements this protocol and communicates a native iOS application’s network requests and managed objects to the developer tools through a WebSocket connection.

Well, that gets our Totally Awesome Award 2012 Edition™ hands down. Well deserved kudos to the authors for their great work and Square for open sourcing it for the rest of us!

h/t: @olebegmann! (And why yes pretty much all the rest of you reading this too, but we saw his tweet first.)

UPDATE:

Tool/Library Providing An F-Script Like Shell For Tweaking iOS Apps Remotely is a nicely complementary tool.

1