NSPsistentDocument "Unsupported Storage Type" Exception

I ran into this problem twice: Xcode 4.1 project, Lion, and NSPersistentDocument Core Data.

My program worked fine until I added two binary data attributes to one of the objects in my model. Now, when I launch the application and try to save the document, an exception is thrown from configurePersistentStoreCoordinatorForURL:ofType:modelConfiguration:storeOptions:error:

The last time I started getting this error, I updated the setting in the target settings of the project. At that time, resetting the changed parameter did not affect, I had to restore the Xcode project file from the backup, and then it worked - therefore it is not associated with the code.

This is the log at the time the exception was 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 am currently using SQLite storage type. I also tried to remove the attributes that I added to the object, but I get the same result. I also cleared all caches, cleared the project, and deleted the DerivedData folder. I also disabled autosavesInPlace . I feel this is a kind of Xcode error.

Has anyone seen this before? Thanks!

+4
source share
2 answers

The same thing happened to me. In fact, the error in Xcode is the following (at least in my case): when setting the value for the key "Main type of main data warehouse" (NSPersistentStoreTypeKey), choosing it from the pop-up menu in the nice user interface for document types (Target → Info), Xcode sets the value to the string "NSSQLiteStoreType" (for example) instead of "SQLite".

Fixing this directly in Info.plist really worked for me (there is no need to recreate the project from scratch).

+7
source

To answer my own question. This is an Xcode error. Go figure. How frustrating.

I backed up all the source code, recreated the new project from scratch, copied the source code into the project and ran it. Everything is working now.

Glad to know it is not for me, at least.

0
source

Source: https://habr.com/ru/post/1369322/


All Articles