rentzsch.com: tales from the red shed

Debugging via Posers

Cocoa

Dan Wood:

We have used class posing quite a few times just to insert some extra warnings for our debug builds. A lot of times, you can catch a nasty condition before it happens and provide some information about what’s happening.

Agreed. For what its worth, here’s a debugging poser I wrote for NSNotificationCenter a while back: NSNotificationCenter+DebuggingPoser.

It logs which notifications get sent to which target+selector. Notifications are handy, but their implicit nature can lead to “why did that happen?!?”-style debugging. That poser can help lift the fog.

If I recall correctly, I wrote it debugging a nasty category method name collision between an EOF app and AddressBook.framework.

Sunday, December 24, 2006
04:49 AM