Question

I have a simple NSArrayController hooked up to one of my coreData models. I can easily show all the items in a NSTableView without problem, however, if I try to bind a NSTableColumn containing a NSPopUpButtonCell to the arrangedObjects on the same controller, I get a nasty exception thrown at me. (If I bind to a NSPopupButton that is outside the table, however, everything seems to work correctly)

Catchpoint 2 (throw)2011-12-18 16:00:07.251 MyApp[6050:707] -[MyCoreDataModel count]: unrecognized selector sent to instance 0x10045aea0

Catchpoint 2 (exception thrown).2011-12-18 16:01:32.901 MyApp[6050:707] -[MyCoreDataModel count]: unrecognized selector sent to instance 0x10045aea0
2011-12-18 16:01:32.907 MyApp[6050:707] (
    0   CoreFoundation                      0x00007fff9191e286 __exceptionPreprocess + 198
    1   libobjc.A.dylib                     0x00007fff93bd6d5e objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff919aa4ce -[NSObject doesNotRecognizeSelector:] + 190
    3   CoreFoundation                      0x00007fff9190b133 ___forwarding___ + 371
    4   CoreFoundation                      0x00007fff9190af48 _CF_forwarding_prep_0 + 232
    5   AppKit                              0x00007fff8b5bbad3 -[_NSSelectionBinderPlugin populateObject:withContent:valueKey:objectKey:insertsNullPlaceholder:] + 235
    6   AppKit                              0x00007fff8b45242e -[NSSelectionBinder _adjustObject:mode:observedController:observedKeyPath:context:editableState:adjustState:] + 678
    7   AppKit                              0x00007fff8b56f11a -[NSValueBinder updateTableColumnDataCell:forDisplayAtIndex:] + 145
    8   AppKit                              0x00007fff8b5af502 -[_NSBindingAdaptor tableColumn:willDisplayCell:row:] + 112
    9   AppKit                              0x00007fff8b0a00b1 -[NSTableView _tryCellBasedMouseDown:atRow:column:withView:] + 498
    10  AppKit                              0x00007fff8b062a4c -[NSTableView mouseDown:] + 1072
    11  AppKit                              0x00007fff8afc90e0 -[NSWindow sendEvent:] + 6306
    12  AppKit                              0x00007fff8af6168f -[NSApplication sendEvent:] + 5593
    13  AppKit                              0x00007fff8aef7682 -[NSApplication run] + 555
    14  AppKit                              0x00007fff8b17680c NSApplicationMain + 867
    15  InstaLibrary                        0x0000000100001732 main + 34
    16  InstaLibrary                        0x0000000100001704 start + 52

Why is this the case? How come you can't reuse the array controller in multiple places?

Was it helpful?

Solution

How come you can't reuse the array controller in multiple places?

That's not what the error message says. What the error message says is that you tried to bind an array property to a property whose value is not an array:

2011-12-18 16:01:32.901 MyApp[6050:707] -[MyCoreDataModel count]: unrecognized selector sent to instance 0x10045aea0

Meaning “I tried to treat this as an array (send it count), but it wasn't an array (and so didn't respond to count), and that's a problem”.

You've already identified the problem binding, so now you simply need to fix it. For more specific advice, you'll need to edit your question to include at least one screenshot of the binding in question, showing what object is it on, which binding is it, what object did you bind to, what controller key did you set, and what model key path did you set.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top