本文介绍了处理核心数据模型更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道如果你改变了核心数据模型,你已经运行应用程序之前的旧模型,你会得到持久存储错误。您将如何处理Core Data模型的更改,以便不会遇到此错误?
I know that if you change the Core Data model and you have run the app before on the old model that you will get Persistent Store error. How would you handle changes to the Core Data model so you do not get this error? Is there a way to upgrade an old model so that the already saved data is not lost?
推荐答案
如果10.6是您的基准操作系统那么您可以使用 ,具体。
If 10.6 is your baseline OS then you can use lightweight migration, specifically NSInferMappingModelAutomaticallyOption.
是类似和有用的,如果10.6不是你的基准操作系统。
The article I wrote is similar and useful if 10.6 is not your baseline OS.
这篇关于处理核心数据模型更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!