"mutatingNodes" error when binding to an NSArray
"mutatingNodes" error when binding to an NSArray
- Subject: "mutatingNodes" error when binding to an NSArray
- From: Ken Tozier <email@hidden>
- Date: Sun, 19 Oct 2008 07:26:07 -0400
Hi
I'm working my first NSOutlineView app and trying to programatically
bind the the "content" property of an NSOutlineView to a mutable
"files" array property of a class and keep getting the following error
in the console.
*** -[PMProjectView _mutatingNodes]: unrecognized selector sent to
instance 0x11d21ff0
My "files" view is significantly different than a simple Finder-like
hierarchy so the example code here (http://developer.apple.com/documentation/Cocoa/Conceptual/OutlineView/Articles/UsingOutlineDataSource.html
) was of only minimal help.
I did a Google, Apple dev and source code search for that method and
came up empty. The NSOutlineView documentation makes no mention of
this method so what is it looking for? As mentioned, this is my first
attempt at using NSOutlineView, so I have no clue what could be
causing this error.
Any help appreciated
Looking at the GDB back trace, the trouble seems to start in the
following "[PMProjectView initTable]" method
- (void) initTable
{
NSTableColumn *nameColumn;
NSTextFieldCell *nameCell;
NSRect selfFrame = [self frame],
conFrame;
// get content frame size
conFrame = NSMakeRect(0, 0, selfFrame.size.width, 0);
// create text cell
nameCell = [[NSTextFieldCell alloc] init];
// create the name column
nameColumn = [[NSTableColumn alloc] initWithIdentifier: @"name"];
[nameColumn setDataCell: nameCell];
[nameColumn setMinWidth: 1000];
[nameColumn bind: @"value" toObject: self withKeyPath: @"files.name"
options: nil];
// create the table
table = [[NSOutlineView alloc] initWithFrame: conFrame];
NSLog(@"adding name column");
[table addTableColumn: nameColumn];
NSLog(@"setting header view");
[table setHeaderView: nil];
[table setAutoresizingMask: NSViewWidthSizable | NSViewMaxYMargin];
[table setUsesAlternatingRowBackgroundColors: YES];
[table setFocusRingType: NSFocusRingTypeNone];
[table setColumnAutoresizingStyle:
NSTableViewLastColumnOnlyAutoresizingStyle];
// this line prints to the console
NSLog(@"binding content");
// This is where it seems to be failing
[table bind: @"content" toObject: self withKeyPath: @"files" options:
nil];
// this line never prints
NSLog(@"bound content ok");
}
Here's the relevant portion of the GDB backtrace:
#0 0x936f1ff4 in ___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___ ()
#1 0x907a70fb in objc_exception_throw ()
#2 0x936f934a in -[NSObject doesNotRecognizeSelector:] ()
#3 0x936f794c in ___forwarding___ ()
#4 0x936f7a12 in __forwarding_prep_0___ ()
#5 0x933338d7 in -[NSOutlineViewBinder
_observeValueForKeyPath:ofObject:context:] ()
#6 0x9333365d in -[NSOutlineViewBinder
observeValueForKeyPath:ofObject:change:context:] ()
#7 0x92fede77 in -[NSBinder _performConnectionEstablishedRefresh] ()
#8 0x92fe60e8 in -[NSObject(NSKeyValueBindingCreation)
bind:toObject:withKeyPath:options:] ()
#9 0x000135f6 in -[PMProjectView initTable] (self=0x11d22430,
_cmd=0x16c82) at /Users/kentozier/Desktop/PageManager Dev (Leopard)/
PMWidgetLab/PMProjectView.m:170
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden