Q:

Core Data Utility Crash

I'm working through the Core Data Utility at http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreDataUtilityTutorial/Articles/00_introduction.html#//apple_ref/doc/uid/TP40001800-CH202-TP1
I've stumbled on a rather nasty crash SIG_ABRT on the line that reads:
[moc save:&error]

This is the output in the debug:
    2010-07-25 22:24:01.665 CoreDataUtilityTutorial[1607:a0f] -[NSCFNumber timeIntervalSinceReferenceDate]: unrecognized selector sent to instance 0x200022100
2010-07-25 22:24:01.666 CoreDataUtilityTutorial[1607:a0f] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFNumber timeIntervalSinceReferenceDate]: unrecognized selector sent to instance 0x200022100'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x00007fff87e71cc4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x00007fff840ee0f3 objc_exception_throw + 45
    2   CoreFoundation                      0x00007fff87ecb140 +[NSObject(NSObject) doesNotRecognizeSelector:] + 0
    3   CoreFoundation                      0x00007fff87e43cdf ___forwarding___ + 751
    4   CoreFoundation                      0x00007fff87e3fe28 _CF_forwarding_prep_0 + 232
    5   CoreData                            0x00007fff881baede -[NSXMLDocumentMap getXMLAttributeValueFromObject:forAttribute:] + 478
    6   CoreData                            0x00007fff881be7c8 -[NSXMLDocumentMap nodeFromManagedObject:objectIDMap:] + 1160
    7   CoreData                            0x00007fff881bb67c -[NSXMLDocumentMap addObject:objectIDMap:] + 140
    8   CoreData                            0x00007fff8817d400 -[NSMappedObjectStore _addObject:objectIDMap:] + 32
    9   CoreData                            0x00007fff8817c98f -[NSMappedObjectStore executeSaveChangesRequest:withContext:] + 1343
    10  CoreData                            0x00007fff88177599 -[NSMappedObjectStore executeRequest:withContext:] + 105
    11  CoreData                            0x00007fff88145051 -[NSPersistentStoreCoordinator(_NSInternalMethods) executeRequest:withContext:] + 545
    12  CoreData                            0x00007fff88179123 -[NSManagedObjectContext save:] + 323
    13  CoreDataUtilityTutorial             0x00000001000015b7 main + 303
    14  CoreDataUtilityTutorial             0x0000000100000cac start + 52
    15  ???                                 0x0000000000000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'

Anyone have an idea? I rechecked the code to see if I mistyped something but nothing is wrong...
Thanks in advance.

A:

Without your actual code, this is a wild stab in the dark, but it looks as if your store is improperly configured at some juncture. Specifically, it looks as if the runtime is expecting a date, but the store has a number.
This could result from making changes to a model without doing a full recompile, maybe.
It could of course be something completely different, but without your specific code, or at the very least a diff against the finished example project as supplied with the tutorial, this is pretty difficult to troubleshoot.
(Another, not impossible, alternative, is that the tutorial was written to assume a specific, earlier version of Mac OS X, like 10.4 or 10.5. This could also result in problems, especially if the default settings for a Core Data project has changed, and this is a result of using the XML store over, say, the SQLite store.)

