Binding woes, connecting model to NSArrayController, crash on remove/insert
Binding woes, connecting model to NSArrayController, crash on remove/insert
- Subject: Binding woes, connecting model to NSArrayController, crash on remove/insert
- From: "Sean McBride" <email@hidden>
- Date: Mon, 2 Aug 2004 19:19:14 -0400
I'm a bindings newbie, and while I think I'll love them, I'm getting the
hang only slowly.
I'm doing something almost exactly like the "Creating a Master-Detail
Interface" example of Apple's here:
<
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/
Tasks/masterdetail.html#//apple_ref/doc/uid/20002090/BCICADHC>
The view-NSArrayController connections seems OK.
If I don't bind the NSArrayController to any model, I am able to insert
and remove using two push buttons I set up. I assume in this case, the
NSArrayController creates its own NSMutableArray.
Further, if in my own controller (MyRegController: old style, not an
NSArrayController) I call:
[myNSArrayController addObject: newModelItem];
All is still well.
The problems start if I try to bind my NSArrayController in IB to my
model. I set 'bind to' to "File's Owner (MyRegController)", 'Controller
key' to nothing, 'Model Key Path' to "myModelArray", which is an
NSMutableArray* in MyRegController. If I call setMyModelArray from
MyRegController, the views update correctly. Good. But, if I click my
insert or remove buttons, the app crashes.
I've been stuck on this for 2 days, and would appreciate any help! :) Thanks!
PS: Here's the bt:
#0 0x9083293c in class_initialize
#1 0x90831524 in _class_lookupMethodAndLoadCache
#2 0x90831298 in objc_msgSend
#3 0x931aea80 in -[_NSModelObservingTracker
setIndexReferenceModelObjectArray:clearAllModelObjectObserving:]
#4 0x931d332c in -[NSArrayController _setObjects:]
#5 0x931d36bc in -[NSArrayController _setContentInBackground:]
#6 0x931df12c in -[NSArrayDetailBinder _refreshDetailContentInBackground:]
#7 0x931df754 in -[NSArrayDetailBinder _performArrayBinderOperation:
singleObject:multipleObjects:singleIndex:multipleIndexes:selectionMode:]
#8 0x931df98c in -[NSArrayDetailBinder
removeObjectFromMasterArrayRelationshipAtIndex:selectionMode:]
#9 0x931d51fc in -[NSArrayController _removeObjectAtArrangedObjectIndex:
objectHandler:]
#10 0x931d576c in -[NSArrayController removeObjectsAtArrangedObjectIndexes:]
#11 0x931d5da8 in -[NSArrayController remove:]
#12 0x92e77ac0 in -[NSApplication sendAction:to:from:]
#13 0x92e7e844 in -[NSControl sendAction:to:]
#14 0x92eb8abc in -[NSCell _sendActionFrom:]
#15 0x92e58500 in -[NSCell trackMouse:inRect:ofView:untilMouseUp:]
#16 0x92ec96cc in -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:]
#17 0x92e8e904 in -[NSControl mouseDown:]
#18 0x92e02c60 in -[NSWindow sendEvent:]
#19 0x92df5324 in -[NSApplication sendEvent:]
#20 0x92dfd73c in -[NSApplication run]
#21 0x92eb9b80 in NSApplicationMain
#22 0x000f2f74 in main at main.m:13
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.