"NSInternalInconsistencyException', reason: 'This NSPersistentStoreCoordinator has no persistent stores. It cannot perform a save operation.'"

在做要用到Core Data 相关的项目,突然出现错误

"NSInternalInconsistencyException', reason: 'This NSPersistentStoreCoordinator has no persistent stores.  It cannot perform a save operation.'"

我在程序中已经创建了持久化存储协调器,并使用SQLite数据库做持久化存储。

最好还是在stockover找到答案:

http://stackoverflow.com/questions/1091228/i-keep-on-getting-save-operation-failure-after-any-change-on-my-xcode-data-mod

“If you are only getting this error in the Simulator then you have changed your data model and it hasn't deleted the sqlite file that you were previously using.

So go to: ~/Library/Application Support/iPhone Simulator/User/Applications/

Then look through the HEX-named folders until you see your app. Open the Documents directory and delete the sqlite file. The error should go away.”

可能是你改变coredata的属性项之后再运行的话在模拟器中会出现这个问题。找上面说的,找到mac下的模拟器中的程序路径,然后删掉其sqlite文件再运行就好了!!!

posted on 2012-09-03 20:41  老Zhan  阅读(4512)  评论(0编辑  收藏  举报