Skip to content

Comment on Reader-submitted Objective-C / XCode tips of 2012parent

Comments

I mentioned this to Mattt on Twitter but I don't think he saw it. There's a lot you can do at the debugger and recursiveDescription can be called on any UIView or UIView subclass. So if you set a breakpoint you can do something like:

    (lldb) po [self.view recursiveDescription]
from one of your view controllers to dump the hierarchy of that view. This of course will work on any object that is a subclass of UIView, such as a UITableView (subclass of UIScrollView, which is in turn a subclass of UIView), a UITableViewCell (directly inherited from UIView), etc.

There's a lot of good information provided by Apple on debugging here: http://developer.apple.com/library/ios/#technotes/tn2239/

It's definitely worth the time to go through it all if you spend any time debugging iOS code (and there's a Mac OS X equivalent but I can't speak for its usefulness).

I've also started writing a little piece on debugging code with lldb and Xcode, but it's a work in progress: https://gist.github.com/3943317

A good accompanying video from one of the XCode devs is the video from WWDC 2012 319 - Effective Debugging with Xcode 4

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.