我只是为我的应用程序中的首选项窗口编写了更多的东西,我运行它,我得到以下错误:
2010-09-09 20:01:08.099 YM2612[12060:80f] An uncaught exception was raised
2010-09-09 20:01:08.102 YM2612[12060:80f] Cannot create BOOL from object <_NSControllerObjectProxy: 0x34cd30> of class _NSControllerObjectProxy
2010-09-09 20:01:08.105 YM2612[12060:80f] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Cannot create BOOL from object
<_NSControllerObjectProxy: 0x34cd30> of class _NSControllerObjectProxy'
*** Call stack at first throw:
(
0 CoreFoundation 0x90d9ebba __raiseError + 410
1 libobjc.A.dylib 0x93aab509 objc_exception_throw + 56
2 CoreFoundation 0x90d9e8e8 +[NSException raise:format:arguments:] + 136
3 AppKit 0x925ae0ed _NSHandleBindingException + 108
4 AppKit 0x91ff0652 _NSBoolFromValue + 490
5 AppKit 0x920f226f -[_NSCheckBoxPlugin showValue:inObject:] + 144
6 AppKit 0x91fbdb69 -[NSValueBinder showValue:inObject:] + 384
7 AppKit 0x91fbd5b9 -[NSValueBinder _adjustObject:mode:observedController:observedKeyPath:context:editableState:adjustState:] + 906
8 AppKit 0x91fbd1af -[NSValueBinder _observeValueForKeyPath:ofObject:context:] + 280
9 AppKit 0x91f379ad -[NSBinder _performConnectionEstablishedRefresh] + 85
10 AppKit 0x91f2a0b8 -[NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:] + 721
11 AppKit 0x91fd6003 -[NSNibBindingConnector establishConnection] + 156
12 AppKit 0x91f053f3 -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1249
13 AppKit 0x91f03508 loadNib + 257
14 AppKit 0x91f02900 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 228
15 AppKit 0x91f02811 +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] + 158
16 AppKit 0x91f0275c +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 383
17 AppKit 0x91eff561 NSApplicationMain + 434
18 YM2612 0x00002844 main + 30
19 YM2612 0x000027fa start + 54
Run Code Online (Sandbox Code Playgroud)
)
阅读你得到的信息:
Run Code Online (Sandbox Code Playgroud)2010-09-09 20:01:08.102 YM2612[12060:80f] Cannot create BOOL from object <_NSControllerObjectProxy: 0x34cd30> of class _NSControllerObjectProxy
那东西不能转换为BOOL.猜测,它是一个对象控制器selection,它是该对象的类名称所代表的代理.
那么,为什么要尝试将其转换为BOOL?为此,您查看堆栈跟踪:
Run Code Online (Sandbox Code Playgroud)4 AppKit 0x91ff0652 _NSBoolFromValue + 490 5 AppKit 0x920f226f -[_NSCheckBoxPlugin showValue:inObject:] + 144 6 AppKit 0x91fbdb69 -[NSValueBinder showValue:inObject:] + 384 7 AppKit 0x91fbd5b9 -[NSValueBinder _adjustObject:mode:observedController:observedKeyPath:context:editableState:adjustState:] + 906 8 AppKit 0x91fbd1af -[NSValueBinder _observeValueForKeyPath:ofObject:context:] + 280 9 AppKit 0x91f379ad -[NSBinder _performConnectionEstablishedRefresh] + 85 10 AppKit 0x91f2a0b8 -[NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:] + 721 11 AppKit 0x91fd6003 -[NSNibBindingConnector establishConnection] + 156 12 AppKit 0x91f053f3 -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1249
你正在加载一个笔尖,并且,作为其中的一部分,它正在连接你在IB中设置的绑定.
因此,您绑定了一个属性,该属性需要一个BOOL其值无法转换为a的属性BOOL.您需要在笔尖看(帧的帧16的接近17顾名思义就是MainMenu.nib中),看看你的约束,其布尔属性,你必将他们什么,并绑定一个绑定到控制器的一个selection的东西,更有意义.
也许你的意思是绑定到控制器selectedObjects(它是一个数组,而不是一个代理对象)@count作为模型关键路径?
你最有可能约束,且需要一个布尔值的绑定enabled和editable任何控制(按钮,文本字段,滑块等).但是,它们并不是唯一的,所以你需要查看每个具有绑定绑定的对象,特别是如果你连接的任何enabled/ editable绑定结果不是罪魁祸首.