我已經使用基於文檔的應用程序與Core Data一起工作。但是請知道,我正在嘗試構建類似於Mac OS X上的Notes
應用的應用。因此,我創建了一個非數據模型的基於文檔的應用。我將這些值與我之前的Core Data應用程序以相同的方式完全一樣。在非基於文檔的應用程序中使用核心數據 - Cocoa
我arrayController
設置爲Entity Mode
與我的實體的名稱,其Prepares Contents
被選中,這是ManagedObjectContext
結合到File's Owner
的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
我在做什麼錯?
您是否在應用程序委託上創建了核心數據堆棧? – J2theC 2013-04-04 17:28:12