I've run into this problem twice now: Xcode 4.1, Lion, and a NSPersistentDocument Core Data project.
My program was running fine until I added two "binary data" attributes to one of the entities in my model. Now, when I run the app and try to save the document, an exception is thrown from within configurePersistentStoreCoordinatorForURL:ofType:modelConfiguration:storeOptions:error:
.
The last time I started getting this error, it was when I updated a setting in the project's target settings. At that time, resetting the altered setting had no effect, I had to restore the Xcode project file from a backup and then it worked - so it wasn't code related.
This is the log at the time the exception is thrown:
2011-08-27 17:34:00.867 MyAppName[5690:707] Unsupported store type.
2011-08-27 17:34:00.879 MyAppName[5690:707] (
0 CoreFoundation 0x00007fff8ae0e986 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff8e28cd5e objc_exception_throw + 43
2 CoreData 0x00007fff9576776a -[NSPersistentStoreCoordinator addPersistentStoreWithType:configuration:URL:options:error:] + 1530
3 AppKit 0x00007fff9190af88 -[NSPersistentDocument configurePersistentStoreCoordinatorForURL:ofType:modelConfiguration:storeOptions:error:] + 554
4 MyAppName 0x0000000100001af4 -[MyAppNameDocument configurePersistentStoreCoordinatorForURL:ofType:modelConfiguration:storeOptions:error:] + 244
5 AppKit 0x00007fff91bc6697 -[NSPersistentDocument(NSDeprecatedInternal) _configurePersistentStoreCoordinatorForURL:ofType:error:] + 172
6 AppKit 0x00007fff91909a82 -[NSPersistentDocument writeToURL:ofType:forSaveOperation:originalContentsURL:error:] + 418
7 MyAppName 0x0000000100001c51 -[MyAppNameDocument writeToURL:ofType:forSaveOperation:originalContentsURL:error:] + 161
8 AppKit 0x00007fff917c5062 -[NSDocument _writeSafelyToURL:ofType:forSaveOperation:forceTemporaryDirectory:error:] + 581
9 AppKit 0x00007fff917aeaba -[NSDocument _writeSafelyToURL:ofType:forSaveOperation:error:] + 27
10 AppKit 0x00007fff917c4e0b -[NSDocument writeSafelyToURL:ofType:forSaveOperation:error:] + 344
11 AppKit 0x00007fff919095d1 -[NSPersistentDocument writeSafelyToURL:ofType:forSaveOperation:error:] + 1073
12 AppKit 0x00007fff917cdee4 __-[NSDocument saveToURL:ofType:forSaveOperation:completionHandler:]_block_invoke_8 + 329
13 AppKit 0x00007fff917cd5ca __-[NSDocument saveToURL:ofType:forSaveOperation:completionHandler:]_block_invoke_14 + 451
14 AppKit 0x00007fff917cdcbd __-[NSDocument saveToURL:ofType:forSaveOperation:completionHandler:]_block_invoke_7 + 1459
15 Foundation 0x00007fff94079f34 -[NSFileCoordinator(NSPrivate) _invokeAccessor:orDont:thenRelinquishAccessClaimForID:] + 202
16 Foundation 0x00007fff9407cdd5 -[NSFileCoordinator(NSPrivate) _coordinateWritingItemAtURL:options:error:byAccessor:] + 663
17 AppKit 0x00007fff917c3754 -[NSDocument _fileCoordinator:coordinateReadingContentsAndWritingItemAtURL:byAccessor:] + 336
18 AppKit 0x00007fff917b1bb3 __-[NSDocument saveToURL:ofType:forSaveOperation:completionHandler:]_block_invoke_1 + 845
19 AppKit 0x00007fff917acbda -[NSDocument continueFileAccessUsingBlock:] + 227
20 AppKit 0x00007fff917c7413 -[NSDocument _performFileAccessOnMainThread:usingBlock:] + 466
21 AppKit 0x00007fff917c716b -[NSDocument performAsynchronousFileAccessUsingBlock:] + 304
22 AppKit 0x00007fff917b1860 -[NSDocument saveToURL:ofType:forSaveOperation:completionHandler:] + 91
23 AppKit 0x00007fff917b0555 __-[NSDocument saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:]_block_invoke_2 + 131
24 AppKit 0x00007fff917be5e0 -[NSDocument _commitEditingThenContinue:] + 337
25 AppKit 0x00007fff91908d32 __-[NSPersistentDocument _documentEditor:didCommit:withContext:]_block_invoke_1 + 53
26 CoreFoundation 0x00007fff8adc3b5c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
27 CoreFoundation 0x00007fff8ad7bc52 __CFRunLoopDoBlocks + 322
28 CoreFoundation 0x00007fff8ada3d37 __CFRunLoopRun + 2023
29 CoreFoundation 0x00007fff8ada3216 CFRunLoopRunSpecific + 230
30 HIToolbox 0x00007fff8ce604ff RunCurrentEventLoopInMode + 277
31 HIToolbox 0x00007fff8ce67b73 ReceiveNextEventCommon + 181
32 HIToolbox 0x00007fff8ce67aae BlockUntilNextEventMatchingListInMode + 62
33 AppKit 0x00007fff91410191 _DPSNextEvent + 659
34 AppKit 0x00007fff9140fa95 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 135
35 AppKit 0x00007fff9140c3d6 -[NSApplication run] + 463
36 AppKit 0x00007fff9168a52a NSApplicationMain + 867
37 MyAppName 0x00000001000012e2 main + 34
38 MyAppName 0x00000001000012b4 start + 52
)
I'm currently using an SQLite store type. I also tried removing the attributes that I added to the entity, but I get the same result. I also cleared all caches, cleaned the project, and delete the DerivedData folder . I also turned off autosavesInPlace
. I feel like this is some sort of Xcode bug.
Has anyone seen this before? Thanks!
The same happened to me. Actually the bug in Xcode is the following (at least in my case): when setting the value for the key "Core Data persistent store type" (NSPersistentStoreTypeKey) by selecting it from the pop up menu in the nice UI for Document Types (Target -> Info), Xcode sets the value to the string "NSSQLiteStoreType" (for example) instead of "SQLite".
Fixing this directly in the Info.plist did work for me (no need to recreate the project from scratch).