如何同步两个界面元素并在终止时保存值?我将复选框的状态和启用的文本字段连接到 NSObjectController。 “内容”导出也连接到复选框。 (不知道为什么?)。它与 NSObjectController 一起使用,但每当我将值绑定(bind)到 NSUserDefaultsController 时,我的应用程序在启动时崩溃并出现以下错误:
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.'
最佳答案
selection
来自 NSObjectController,而 NSUserDefaultsController 并不是一种 NSObjectController。您需要通过其值
进行绑定(bind)。
关于objective-c - NSUserDefaults 和绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3458253/