Runtime error possibly due to corrupted autosave(?)


#1

While I was messing around with the code to solve the challenge, I must’ve messed something up because now I get this runtime error when running my code or the code in the downloaded solution (Chapter 11 - Basic Core Data >> CarLot).

2011-12-27 16:46:34.531 CarLot[45744:707] An uncaught exception was raised
2011-12-27 16:46:34.532 CarLot[45744:707] [<MyDocument 0x100466a30> valueForUndefinedKey:]: this class is not key value coding-compliant for the key carsController.
2011-12-27 16:46:34.538 CarLot[45744:707] (
	0   CoreFoundation                      0x00007fff8daa3286 __exceptionPreprocess + 198
	1   libobjc.A.dylib                     0x00007fff90f49d5e objc_exception_throw + 43
	2   CoreFoundation                      0x00007fff8db2d4c9 -[NSException raise] + 9
	3   Foundation                          0x00007fff8807f783 -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 240
	4   Foundation                          0x00007fff87fb6462 _NSGetUsingKeyValueGetter + 108
	5   Foundation                          0x00007fff87fb63e9 -[NSObject(NSKeyValueCoding) valueForKey:] + 392
	6   Foundation                          0x00007fff87fd5e76 -[NSObject(NSKeyValueCoding) valueForKeyPath:] + 348
	7   Foundation                          0x00007fff87fd5e39 -[NSObject(NSKeyValueCoding) valueForKeyPath:] + 287
	8   AppKit                              0x00007fff8f042f46 -[NSBinder _valueForKeyPath:ofObject:mode:raisesForNotApplicableKeys:] + 654
	9   AppKit                              0x00007fff8f042c30 -[NSBinder valueForBinding:resolveMarkersToPlaceholders:] + 171
	10  AppKit                              0x00007fff8f29eb78 -[NSArrayDetailBinder _refreshDetailContentInBackground:] + 407
	11  AppKit                              0x00007fff8f034bdb -[NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:] + 591
	12  AppKit                              0x00007fff8f02def5 -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1079
	13  AppKit                              0x00007fff8f02452f loadNib + 322
	14  AppKit                              0x00007fff8f023a28 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 217
	15  AppKit                              0x00007fff8f023943 +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] + 141
	16  AppKit                              0x00007fff8f212bc6 -[NSWindowController loadWindow] + 221
	17  AppKit                              0x00007fff8f212981 -[NSWindowController window] + 75
	18  AppKit                              0x00007fff8f287703 -[NSDocument(NSPersistentUISupport) restoreDocumentWindowWithIdentifier:state:completionHandler:] + 520
	19  AppKit                              0x00007fff8f2874aa -[NSDocumentControllerPersistentRestoration loadedDocument:forAutoID:] + 179
	20  AppKit                              0x00007fff8f286fbe __-[NSDocumentController reopenDocumentForURL:withContentsOfURL:display:completionHandler:]_block_invoke_8 + 187
	21  AppKit                              0x00007fff8f272e14 __-[NSDocumentController reopenDocumentForURL:withContentsOfURL:display:completionHandler:]_block_invoke_5 + 163
	22  AppKit                              0x00007fff8f272d5f __-[NSDocumentController reopenDocumentForURL:withContentsOfURL:display:completionHandler:]_block_invoke_4 + 697
	23  AppKit                              0x00007fff8f272aa1 -[NSDocumentController _openDocumentWithContentsOfURL:usingProcedure:] + 530
	24  AppKit                              0x00007fff8f27268d __-[NSDocumentController reopenDocumentForURL:withContentsOfURL:display:completionHandler:]_block_invoke_3 + 242
	25  libdispatch.dylib                   0x00007fff926f88ba _dispatch_call_block_and_release + 18
	26  libdispatch.dylib                   0x00007fff926fa72a _dispatch_main_queue_callback_4CF + 308
	27  CoreFoundation                      0x00007fff8da384dc __CFRunLoopRun + 1724
	28  CoreFoundation                      0x00007fff8da37ae6 CFRunLoopRunSpecific + 230
	29  HIToolbox                           0x00007fff8ca6c3d3 RunCurrentEventLoopInMode + 277
	30  HIToolbox                           0x00007fff8ca7358f ReceiveNextEventCommon + 181
	31  HIToolbox                           0x00007fff8ca734ca BlockUntilNextEventMatchingListInMode + 62
	32  AppKit                              0x00007fff8f01c3f1 _DPSNextEvent + 659
	33  AppKit                              0x00007fff8f01bcf5 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 135
	34  AppKit                              0x00007fff8f01862d -[NSApplication run] + 470
	35  AppKit                              0x00007fff8f29780c NSApplicationMain + 867
	36  CarLot                              0x0000000100001b02 main + 34
	37  CarLot                              0x0000000100001ad4 start + 52
	38  ???                                 0x0000000000000003 0x0 + 3
)
2011-12-27 16:46:34.540 CarLot[45744:707] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<MyDocument 0x100466a30> valueForUndefinedKey:]: this class is not key value coding-compliant for the key carsController.'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff8daa3286 __exceptionPreprocess + 198
	1   libobjc.A.dylib                     0x00007fff90f49d5e objc_exception_throw + 43
	2   CoreFoundation                      0x00007fff8db2d4c9 -[NSException raise] + 9
	3   Foundation                          0x00007fff8807f783 -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 240
	4   Foundation                          0x00007fff87fb6462 _NSGetUsingKeyValueGetter + 108
	5   Foundation                          0x00007fff87fb63e9 -[NSObject(NSKeyValueCoding) valueForKey:] + 392
	6   Foundation                          0x00007fff87fd5e76 -[NSObject(NSKeyValueCoding) valueForKeyPath:] + 348
	7   Foundation                          0x00007fff87fd5e39 -[NSObject(NSKeyValueCoding) valueForKeyPath:] + 287
	8   AppKit                              0x00007fff8f042f46 -[NSBinder _valueForKeyPath:ofObject:mode:raisesForNotApplicableKeys:] + 654
	9   AppKit                              0x00007fff8f042c30 -[NSBinder valueForBinding:resolveMarkersToPlaceholders:] + 171
	10  AppKit                              0x00007fff8f29eb78 -[NSArrayDetailBinder _refreshDetailContentInBackground:] + 407
	11  AppKit                              0x00007fff8f034bdb -[NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:] + 591
	12  AppKit                              0x00007fff8f02def5 -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1079
	13  AppKit                              0x00007fff8f02452f loadNib + 322
	14  AppKit                              0x00007fff8f023a28 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 217
	15  AppKit                              0x00007fff8f023943 +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] + 141
	16  AppKit                              0x00007fff8f212bc6 -[NSWindowController loadWindow] + 221
	17  AppKit                              0x00007fff8f212981 -[NSWindowController window] + 75
	18  AppKit                              0x00007fff8f287703 -[NSDocument(NSPersistentUISupport) restoreDocumentWindowWithIdentifier:state:completionHandler:] + 520
	19  AppKit                              0x00007fff8f2874aa -[NSDocumentControllerPersistentRestoration loadedDocument:forAutoID:] + 179
	20  AppKit                              0x00007fff8f286fbe __-[NSDocumentController reopenDocumentForURL:withContentsOfURL:display:completionHandler:]_block_invoke_8 + 187
	21  AppKit                              0x00007fff8f272e14 __-[NSDocumentController reopenDocumentForURL:withContentsOfURL:display:completionHandler:]_block_invoke_5 + 163
	22  AppKit                              0x00007fff8f272d5f __-[NSDocumentController reopenDocumentForURL:withContentsOfURL:display:completionHandler:]_block_invoke_4 + 697
	23  AppKit                              0x00007fff8f272aa1 -[NSDocumentController _openDocumentWithContentsOfURL:usingProcedure:] + 530
	24  AppKit                              0x00007fff8f27268d __-[NSDocumentController reopenDocumentForURL:withContentsOfURL:display:completionHandler:]_block_invoke_3 + 242
	25  libdispatch.dylib                   0x00007fff926f88ba _dispatch_call_block_and_release + 18
	26  libdispatch.dylib                   0x00007fff926fa72a _dispatch_main_queue_callback_4CF + 308
	27  CoreFoundation                      0x00007fff8da384dc __CFRunLoopRun + 1724
	28  CoreFoundation                      0x00007fff8da37ae6 CFRunLoopRunSpecific + 230
	29  HIToolbox                           0x00007fff8ca6c3d3 RunCurrentEventLoopInMode + 277
	30  HIToolbox                           0x00007fff8ca7358f ReceiveNextEventCommon + 181
	31  HIToolbox                           0x00007fff8ca734ca BlockUntilNextEventMatchingListInMode + 62
	32  AppKit                              0x00007fff8f01c3f1 _DPSNextEvent + 659
	33  AppKit                              0x00007fff8f01bcf5 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 135
	34  AppKit                              0x00007fff8f01862d -[NSApplication run] + 470
	35  AppKit                              0x00007fff8f29780c NSApplicationMain + 867
	36  CarLot                              0x0000000100001b02 main + 34
	37  CarLot                              0x0000000100001ad4 start + 52
	38  ???                                 0x0000000000000003 0x0 + 3
)
terminate called throwing an exceptionsharedlibrary apply-load-rules all
Current language:  auto; currently objective-c
(gdb) 

Interestingly enough, when I run “Chapter 11 - Basic Core Data >> CarLot-Challenge” the error does not occur.


#2

I sort of fixed this by deleting the Carlot folder in ~/Library/Developer/Xcode/DerivedData and then rebuilding the app. Still not sure what was the real cause of the problem though.