What is the closest utility to Snoop for iPhone/iPad development?

249 Views Asked by At

Is there anything remotely close to the WPF Snoop utility for iPhone/iOS development?

I have found Mike Ash's ObjC wrapper, however this seems more helpful for reflection than for analyzing the instance state of UIKit hierarchies.

An example of where this is useful: I integrated a split-view inside of a tabbar view and it's not quite working. Yes there are some bits of code out there for this to just "make it work". However I want to get dirty and fix my own problems to better master the platform.

The most obvious implementations seem to be to pass in a root viewcontroller instance to a utility class method.

The utility could then output the UIKit hierarchy in the debug window, or to get fancy, popup a modal view that lets you graphically browse the state like Snoop.

1

There are 1 best solutions below

2
On BEST ANSWER

If you want to get your hands dirty, just leverage objective-C's dynamic behavior, and implement it yourself. You could create a category on UIView with a recursive method that prints out info about its children. Then in GDB just call it on the window (since window is a subclass of UIView. Something like:

@interface UIView ( DebugExras )
    - (void)debugPrintViewTree;
@end

And in GDB:

gdb: po [[[UIApplication sharedApplication] keyWindow] debugPrintViewTree]