Dan Wood: The Eponymous Weblog

Dan Wood is co-owner of Karelia Software, creating programs for the Macintosh computer. He is the father of two kids, lives in the Bay Area of California USA, and prefers bicycles to cars. This site is his weblog, which mostly covers geeky topics like Macs and Mac Programming.

Useful Tidbits and Egotistical Musings from Dan Wood

Categories: Mac OS X · Cocoa Programming · General · All Categories

Fri, 08 Apr 2005

Our project uses Cocoa Bindings extensively. This works great, except for when you have a bug. For instance, you might have something defined in your nib file that doesn't correspond to anything in your model object. At runtime, you end up with a crash deep in the bowels of the bindings system, with nothing to help you find your way out other than the stack trace which looks like binding-related code of Apple's. It's completely opaque, of course — you can't tell what was happening between your code line that was running (say, loading a nib file) and where it has crashed.

There needs to be a way to tell what is going on. Maybe a way to log accesses, or a way to view the parameters being passed around when hunting through the stack traces in XCode's debugger. I've found a few clues from time to time, but usually it's a lot of work to figure out what went wrong.

Are there any fellow Cocoa developers using Bindings who have come up with tricks and techniquest for diagnosing bindings gone wrong?