在做要用到Core Data 相關的項目,突然出現錯誤
"NSInternalInconsistencyException', reason: 'This NSPersistentStoreCoordinator has no persistent stores. It cannot perform a save operation.'"
我在程序中已經創建了持久化存儲協調器,並使用SQLite數據庫做持久化存儲。
最好還是在stockover找到答案:
“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文件再運行就好了!!!