处理核心数据模型更改 [英] Handling Core Data Model Changes

查看:116
本文介绍了处理核心数据模型更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如果你改变了核心数据模型,你已经运行应用程序之前的旧模型,你会得到持久存储错误。您将如何处理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是您的基准操作系统那么您可以使用轻量级迁移 ,具体 NSInferMappingModelAutomaticallyOption

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.

这篇关于处理核心数据模型更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆