Once upon a time Last time when QA comes to me, they want visual debugging tool for our iOS apps. I already researched this subject, and already use CocoaLumberjack tool (with XCodeColors plugin of course), but it was not enough.

You can find PonyDebugger GitHub:square/PonyDebugger.

Installation

I’m using CocoaPods, so it really easy to install

If you would like to use the latest version of PonyDebugger, point to the Github repository directly.

Install dependencies.

[/crayon]

Usage

PonyDebugger’s main entry points exist in the  PDDebugger singleton.

[/crayon]

To connect automatically to the PonyGateway on your LAN (via Bonjour):

[/crayon]

Or to open the connection to a specific host, for instance  ws://localhost:9000/device:

[/crayon]

To manually close the connection:

[/crayon]

Network Traffic Debugging

To enable network debugging:

[/crayon]

PonyDebugger inspects network data by injecting logic into  NSURLConnectionDelegate classes. If you want PonyDebugger to automatically find these classes for you:

[/crayon]

This will swizzle methods from private APIs, so you should ensure that this only gets invoked in debug builds. To manually specify delegate classes:

[/crayon]

These methods should be invoked before the connection is opened.

Core Data Browser

PonyDebugger also allows you to browse your application’s managed objects. First, enable Core Data debugging:

[/crayon]

To register a managed object context:

[/crayon]

View Hierarchy Debugging

To enable view hierarchy debugging:

[/crayon]

PonyDebugger will inject logic into  UIView add/remove methods to monitor changes in the view hierarchy.
You can also set the attributes you want to see in the elements panel by passing an array of  UIView key path strings

[/crayon]

PonyDebugger uses KVO to monitor changes in the attributes of all views in the hierarchy, so the information in the elements panel stays fresh.

Remote Logging

To enable remote logging:

[/crayon]

Example usage:

[/crayon]

The repository contains a test application to demonstrate PonyDebugger’s capabilities and usage.
And when I do all steps, nothing happens ….

53054518

Okay, so for exclude any mistakes lets check the list:

  • your device and you mac in one wi-fi network
  • you opened correct address  ws://localhost:9000/
  • you restarted bounjour service or even mac

In my case problem was very obvious, when executing on device localhost is a device, but not a host machine, so you just need to open your network preferences and get your IP-address.

[/crayon]

Also, I was needed to debug core data state, for this is not enough

[/crayon]

you need to point on your context(one or many) to observing.

[/crayon]

For category access used MagicalRecord

Summarizing

And in the end, it doesn’t even matters…

Because PonyDebugger:

  • Slow
  • For network requests uses NSURLConnection and delegates, and using with NSURLSession not supported. There are some tweaks for using with AFNetworing 2.0, but I don’t use it.

Oksana Kovalchuk

Passionate IOS Developer

Related Posts

ios

Asset catalog system file names

Sometimes IOS become not so obvious and not clear. The same happens to me, when I try to load default splash screen. [crayon-5a156e8231d92788649457/] Example for icons: [crayon-5a156e8231d96145198686/] Related

Snippet

Git cloning with sub-modules

For cloning  git repo with submodules, use this command: [crayon-5a156e8231e81129619418/] For already cloned repos, for clone submodules use next command in repo root: [crayon-5a156e8231e85010667448/] And that’s all, Folks. Related

Useful

Xcode build script using

It’s not a secret, that Xcode can run BASH scripts on some events.   But, sometimes when you add your script to Xcode, you don’t think about future modification, git blame, and merge conflict. I Read more...