Hi, I'm trying to do something similar to this:
http://www.raywenderlich.com/21752/how-to-use-cocoa-bindings-and-core-data-in-a-mac-app
Except I have an NSOutlineView instead of an NSTableView.
The part I get stuck at is binding the NSTextField to my NSTreeController's selection.name. When I try running, I get this error:
The thing that seems really odd to me is that it says NSOutlineView is the class it's trying to check at, rather than NSTreeController which seems like it would make a lot more sense... it is set to be bound to Tree Controller.
If I just uncheck this single binding, my whole app runs fine, so I'm pretty sure this is the cause. If I bind the column to arrangedObjects.name, that works fine. So why not selection.name for the text field?
I'm including a zipped file with my whole project so everyone can look at it and hopefully someone can tell me what I'm doing wrong. I haven't gotten far in the project so there's not much to look at. I think the only file of true interest is ShapeyrDocument.xib, although ShapeyrDocument.xcdatamodeId or ShapeyrOutlineViewController.m might be worth looking in...
Here's my full stack:
http://www.raywenderlich.com/21752/how-to-use-cocoa-bindings-and-core-data-in-a-mac-app
Except I have an NSOutlineView instead of an NSTableView.
The part I get stuck at is binding the NSTextField to my NSTreeController's selection.name. When I try running, I get this error:
Code:
[<NSOutlineView 0x10107d5d0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key name.
The thing that seems really odd to me is that it says NSOutlineView is the class it's trying to check at, rather than NSTreeController which seems like it would make a lot more sense... it is set to be bound to Tree Controller.
If I just uncheck this single binding, my whole app runs fine, so I'm pretty sure this is the cause. If I bind the column to arrangedObjects.name, that works fine. So why not selection.name for the text field?
I'm including a zipped file with my whole project so everyone can look at it and hopefully someone can tell me what I'm doing wrong. I haven't gotten far in the project so there's not much to look at. I think the only file of true interest is ShapeyrDocument.xib, although ShapeyrDocument.xcdatamodeId or ShapeyrOutlineViewController.m might be worth looking in...
Here's my full stack:
Code:
(
0 CoreFoundation 0x00007fff8b4f20a6 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff8fd993f0 objc_exception_throw + 43
2 CoreFoundation 0x00007fff8b586229 -[NSException raise] + 9
3 Foundation 0x00007fff8bcea1ec -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 238
4 Foundation 0x00007fff8bc31f59 -[NSObject(NSKeyValueCoding) valueForKey:] + 400
5 Foundation 0x00007fff8bc52808 -[NSObject(NSKeyValueCoding) valueForKeyPath:] + 341
6 AppKit 0x00007fff8911c06c -[NSTreeController _singleValueForKeyPath:] + 162
7 Foundation 0x00007fff8bc527cf -[NSObject(NSKeyValueCoding) valueForKeyPath:] + 284
8 AppKit 0x00007fff89113184 -[NSBinder valueForBinding:resolveMarkersToPlaceholders:] + 163
9 AppKit 0x00007fff89115ad7 -[NSValueBinder _adjustObject:mode:observedController:observedKeyPath:context:editableState:adjustState:] + 667
10 AppKit 0x00007fff8911572c -[NSValueBinder _observeValueForKeyPath:ofObject:context:] + 192
11 AppKit 0x00007fff8911a18b -[NSTextValueBinder _observeValueForKeyPath:ofObject:context:] + 43
12 AppKit 0x00007fff8910a779 -[NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:] + 641
13 AppKit 0x00007fff88f9317a -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1012
14 AppKit 0x00007fff88f721fd loadNib + 317
15 AppKit 0x00007fff88f71729 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 219
16 AppKit 0x00007fff890c468c +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] + 140
17 AppKit 0x00007fff890f76bb -[NSWindowController loadWindow] + 199
18 AppKit 0x00007fff890f7395 -[NSWindowController window] + 77
19 AppKit 0x00007fff89703721 -[NSDocument(NSPersistentUISupport) restoreDocumentWindowWithIdentifier:state:completionHandler:] + 179
20 AppKit 0x00007fff8930edce -[NSDocumentControllerPersistentRestoration loadedDocument:forAutoID:] + 179
21 AppKit 0x00007fff89314775 __block_global_22 + 254
22 AppKit 0x00007fff893143a3 __block_global_19 + 265
23 AppKit 0x00007fff8931428a __block_global_18 + 688
24 AppKit 0x00007fff89311e2a -[NSDocumentController _openDocumentWithContentsOfURL:usingProcedure:] + 593
25 AppKit 0x00007fff89313fcf __block_global_17 + 251
26 libdispatch.dylib 0x00007fff8c1f6f01 _dispatch_call_block_and_release + 15
27 libdispatch.dylib 0x00007fff8c1f30b6 _dispatch_client_callout + 8
28 libdispatch.dylib 0x00007fff8c1f80c8 _dispatch_main_queue_callback_4CF + 275
29 CoreFoundation 0x00007fff8b4940fe __CFRunLoopRun + 1614
30 CoreFoundation 0x00007fff8b4936b2 CFRunLoopRunSpecific + 290
31 HIToolbox 0x00007fff873450a4 RunCurrentEventLoopInMode + 209
32 HIToolbox 0x00007fff87344e42 ReceiveNextEventCommon + 356
33 HIToolbox 0x00007fff87344cd3 BlockUntilNextEventMatchingListInMode + 62
34 AppKit 0x00007fff88fd2613 _DPSNextEvent + 685
35 AppKit 0x00007fff88fd1ed2 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
36 AppKit 0x00007fff88fc9283 -[NSApplication run] + 517
37 AppKit 0x00007fff88f6dcb6 NSApplicationMain + 869
38 Shapeyr 0x0000000100001182 main + 34
39 libdyld.dylib 0x00007fff8808a7e1 start + 0
)