objective-c – NSPersistentDocument“不支持的商店类型”异常
发布时间:2020-12-14 17:41:02 所属栏目:百科 来源:网络整理
导读:我现在遇到过两次这个问题: Xcode 4.1,Lion和NSPersistentDocument Core Data项目. 我的程序运行正常,直到我向模型中的一个实体添加了两个“二进制数据”属性.现在,当我运行应用程序并尝试保存文档时,在configurePersistentStoreCoordinatorForURL中抛出异
我现在遇到过两次这个问题:
Xcode 4.1,Lion和NSPersistentDocument Core Data项目.
我的程序运行正常,直到我向模型中的一个实体添加了两个“二进制数据”属性.现在,当我运行应用程序并尝试保存文档时,在configurePersistentStoreCoordinatorForURL中抛出异常:ofType:modelConfiguration:storeOptions:error:. 上次我开始收到此错误时,就是我更新了项目目标设置中的设置.那时,重置更改的设置没有任何效果,我不得不从备份恢复Xcode项目文件,然后它工作 – 所以它不是代码相关的. 这是抛出异常时的日志: 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 ) 我目前正在使用SQLite商店类型.我也尝试删除我添加到实体的属性,但我得到了相同的结果.我还清除了所有缓存,清理了项目,并删除了DerivedData文件夹.我也关掉了autosavesInPlace.我觉得这是某种Xcode错误. 谁看过这个吗?谢谢! 解决方法
同样的事发生在我身上.实际上Xcode中的错误如下(至少在我的情况下):当设置键“Core Data持久存储类型”(NSPersistentStoreTypeKey)的值时,通过从文档类型的漂亮UI中的弹出菜单中选择它(目标) – > Info),Xcode将值设置为字符串“NSSQLiteStoreType”(例如)而不是“SQLite”.
直接在Info.plist中修复它确实对我有用(无需从头开始重新创建项目). (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |