views:

20

answers:

1

Hi,

How can I synchronize two interface elements and have the value saved at termination? I connected a checkbox' state and a text field's enabled to an NSObjectController. The "content" outlet is connected to the checkbox too. (Not sure why?). It works with the NSObjectController but whenever I bind the value's to an NSUserDefaultsController, my app crashes at launch with this error:

An uncaught exception was raised [ addObserver: forKeyPath:@"selection.enabled" options:0x0 context:0x0] was sent to an object that is not KVC-compliant for the "selection" property. * Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ addObserver: forKeyPath:@"selection.enabled" options:0x0 context:0x0] was sent to an object that is not KVC-compliant for the "selection" property.'

+1  A: 

selection comes from NSObjectController, and the NSUserDefaultsController isn't a kind of NSObjectController. You need to bind through its values instead.

Peter Hosey