Objective-C Debugging Cheat Sheet
Over the years, Apple has provided a few handy tricks here and there about debugging Mac and iOS apps. Sometimes, these tricks take the form of private methods implemented by framework classes; if you know the right selector, you can get your objects to dump all kind of debugging information. (Of course, none of these selectors are suitable for use in released apps, but they can prove really handy during the development cycle.)
Since none of these are really documented, though, it’s easy to confuse which
private methods are available on which classes. For example: if I have a UIView,
should I use -_subtreeDescription
or -recursiveDescription
to log out its
subview hierarchy? And is that really where that underscore goes, or did I get
it backwards?
After some nudging from coworkers, I took some time and scraped together all the various private methods I could find (as well as a few suggested on Twitter) and combined them into one debugging cheat sheet, which I’m making available right here. Download it today, and suggest more!
Update: @monowerker put together a Dash version of this cheat sheet, which you can find on GitHub here. Thanks!