天天看點

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

在做要用到Core Data 相關的項目,突然出現錯誤

我在程式中已經建立了持久化存儲協調器,并使用SQLite資料庫做持久化存儲。

最好還是在stockover找到答案:

<a href="http://stackoverflow.com/questions/1091228/i-keep-on-getting-save-operation-failure-after-any-change-on-my-xcode-data-mod">http://stackoverflow.com/questions/1091228/i-keep-on-getting-save-operation-failure-after-any-change-on-my-xcode-data-mod</a>

“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: <code>~/Library/Application Support/iPhone Simulator/User/Applications/</code>

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

可能是你改變coredata的屬性項之後再運作的話在模拟器中會出現這個問題。找上面說的,找到mac下的模拟器中的程式路徑,然後删掉其sqlite檔案再運作就好了!!!

   本文轉自老Zhan部落格園部落格,原文連結:http://www.cnblogs.com/mybkn/archive/2012/09/03/2669412.html,如需轉載請自行聯系原作者