Debugging Bindings

Bindings are a powerful feature of Cocoa, but they are notoriously difficult to debug. To a new Cocoa developer (and indeed even to the experienced), they can be quite mysterious. Because they are generally configured in the XIB file it can be difficult to track down the source of a problematic binding. Additionally, because they use strings, the compiler cannot help you by checking that the key actually exists on the object you are attempting to bind to.

The most common problem in using bindings is a key name typo, followed closely by binding to the wrong object. You will see this error at runtime when the related NIB file is opened: an exception will be logged to the console. There will be a couple dozen lines ...

Get Cocoa Programming for OS X: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.