tags:

views:

34

answers:

1

I was just coding up some more stuff for the preferences window in my app, and I run it, I get this following error: 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

)

+1  A: 

Read the message you got:

2010-09-09 20:01:08.102 YM2612[12060:80f] Cannot create BOOL from object <_NSControllerObjectProxy: 0x34cd30> of class _NSControllerObjectProxy

That thing can't be converted to a BOOL. At a guess, it's an object controller's selection, which is a proxy as that object's class name says.

So, why is something trying to convert it to a BOOL? For that, you look in the stack trace:

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

You're loading a nib, and, as part of that, it's hooking up a binding you set in IB.

So, you bound a property that requires a BOOL to a property whose value cannot be converted to a BOOL. You need to look in the nib (which the proximity of frame 16 to frame 17 suggests is MainMenu.nib) to see which Boolean properties you bound, and what you bound them to, and bind the one that's bound to a controller's selection to something that makes more sense.

Perhaps you meant to bind to the controller's selectedObjects (which is an array, rather than a proxy object) with @count as the model key path?

The bindings you're most likely to have bound that take a Boolean value are enabled and editable of any control (button, text field, slider, etc.). But, they're not the only ones, so you'll need to look at every object that has a binding you've bound, especially if any enabled/editable bindings you've hooked up turn out not to be the culprits.

Peter Hosey