我曾使用基于文档的应用程序使用 Core Data。但是知道,我正在尝试构建一个类似于Notes
Mac OS X 上的应用程序的应用程序。所以我创建了一个基于数据模型的非文档应用程序。我绑定值的方式与我以前的 Core Data 应用程序完全相同。
MyarrayController
设置为Entity Mode
我的实体的名称,它Prepares Contents
被检查并且它ManagedObjectContext
被绑定到File's Owner
's managedObjectContext
。这正是我在以前的应用程序中所做的。但是使用这些绑定,我有以下错误:
[<NSApplication 0x101a032c0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key managedObjectContext.
(
0 CoreFoundation 0x00007fff96525b06 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff915563f0 objc_exception_throw + 43
2 CoreFoundation 0x00007fff965b9f49 -[NSException raise] + 9
3 Foundation 0x00007fff91e518bc - [NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 238
4 Foundation 0x00007fff91d99539 - [NSObject(NSKeyValueCoding) valueForKey:] + 400
5 AppKit 0x00007fff8f41a6fb - [NSApplication(NSScripting) valueForKey:] + 514
6 Foundation 0x00007fff91db9de8 -[NSObject(NSKeyValueCoding) valueForKeyPath:] + 341
7 AppKit 0x00007fff8f6580d4 -[NSBinder valueForBinding:resolveMarkersToPlaceholders:] + 163
8 AppKit 0x00007fff8f665a13 -[NSObjectParameterBinder _updateObject:observedController:observedKeyPath:context:] + 1046
9 AppKit 0x00007fff8f64f6c9 -[NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:] + 641
10 AppKit 0x00007fff8f4d80ca -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1012
11 AppKit 0x00007fff8f4b714d loadNib + 317
12 AppKit 0x00007fff8f4b6679 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 219
13 AppKit 0x00007fff8f4b64ae -[NSBundle(NSNibLoading) loadNibNamed:owner:topLevelObjects:] + 200
14 AppKit 0x00007fff8f4b628e +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 360
15 AppKit 0x00007fff8f4b2a2f NSApplicationMain + 398
16 Secrets 0x0000000100000ea2 main + 34
17 libdyld.dylib 0x00007fff920927e1 start + 0
18 ??? 0x0000000000000003 0x0 + 3
)
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<NSApplication 0x101a032c0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key managedObjectContext.'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff96525b06 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff915563f0 objc_exception_throw + 43
2 CoreFoundation 0x00007fff965b9f49 -[NSException raise] + 9
3 Foundation 0x00007fff91e518bc -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 238
4 Foundation 0x00007fff91d99539 -[NSObject(NSKeyValueCoding) valueForKey:] + 400
5 AppKit 0x00007fff8f41a6fb -[NSApplication(NSScripting) valueForKey:] + 514
6 Foundation 0x00007fff91db9de8 -[NSObject(NSKeyValueCoding) valueForKeyPath:] + 341
7 AppKit 0x00007fff8f6580d4 -[NSBinder valueForBinding:resolveMarkersToPlaceholders:] + 163
8 AppKit 0x00007fff8f665a13 -[NSObjectParameterBinder _updateObject:observedController:observedKeyPath:context:] + 1046
9 AppKit 0x00007fff8f64f6c9 -[NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:] + 641
10 AppKit 0x00007fff8f4d80ca -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1012
11 AppKit 0x00007fff8f4b714d loadNib + 317
12 AppKit 0x00007fff8f4b6679 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 219
13 AppKit 0x00007fff8f4b64ae -[NSBundle(NSNibLoading) loadNibNamed:owner:topLevelObjects:] + 200
14 AppKit 0x00007fff8f4b628e +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 360
15 AppKit 0x00007fff8f4b2a2f NSApplicationMain + 398
16 Secrets 0x0000000100000ea2 main + 34
17 libdyld.dylib 0x00007fff920927e1 start + 0
18 ??? 0x0000000000000003 0x0 + 3
)
libc++abi.dylib: terminate called throwing an exception
我究竟做错了什么?