核心数据迁移 [英] core data migration

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

问题描述

我在核心数据迁移方面遇到了一些问题。我的应用程式1.0、1.1、1.2有3个版本。

i am having some issues with Core data migration. i am having 3 versions of my app 1.0, 1.1, 1.2.

对于前两个版本(1.0和1.1),我具有相同的数据模型,但对于第三版(1.2)我已经对数据模型进行了一些更改。现在我的应用程序版本1.2出现了不兼容的问题(尽管它的重量有所变化)。

for the 1st two versions(1.0 and 1.1), i am having the same data model, but for third version(1.2) i have done some changes in my data model. Now i am getting incompatible issue at version 1.2 of my app(though its a light weight changes).

我想我错过了版本1.1的数据模型版本在我的应用程序中,由于1.0和1.1的数据模型没有变化,因此我还没有创建另一个数据模型版本。

I am thinking that i have missed the data model version at version 1.1 of my app, as there is no change in the datamodel for 1.0 and 1.1, i havent created another data model version.

我们是否需要为新的应用版本,即使版本之间的数据模型也没有变化。

Do we need to create a data model version for new app version, even there is no change in the data model between the versions.

很抱歉,如果我的查询太迟...请提出建议。

sorry if my query is too dum... please suggest..

推荐答案

如果要更改模型,但又要保留使用该模型的先前版本创建的商店的功能,则必须保留先前的版本模型的版本(作为版本化模型中的版本)。 Core Data无法打开没有兼容模型的商店。因此,如果要更改
模型,但又要保留开设现有商店的功能,则必须:

If you want to change the model but also retain the ability to open stores created using a previous version of the model, you must keep the previous version of the model (as a version in a versioned model). Core Data cannot open a store for which it has no compatible model. Thus, if you want to change the model but also retain the ability to open existing stores, you must:


  1. 确保您有一个版本化模型-如果没有,则将当前模型转变为版本化模型。

  2. 在编辑架构之前,请创建当前模型的新版本。

  3. 编辑模型的新当前版本,而保留旧版本不变。

请参考
链接
版本控制的分步过程

Please refer the link for step by step procedure of versioning

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

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