简体   繁体   English

核心数据数据库在新的应用程序版本中更新

[英]Core-data database updated in new app version

I have an application in XCode using the sqlite/coredata database and that has already been submitted to the app store. 我在XCode中使用sqlite / coredata数据库并且已经提交到应用商店。

Now I have changed the database so my managed object is changed now and I want to submit the updated new version of my app. 现在我已经更改了数据库,因此我的托管对象现在已更改,我想提交更新的应用程序新版本。 I also want that the people who have already downloaded the previous version of app won't loose any data in the old database.How this can be achieved? 我还希望已经下载了以前版本的应用程序的人不会丢失旧数据库中的任何数据。如何实现这一目标? Any help would be appreciated. 任何帮助,将不胜感激。

This documentation is the official word on the subject. 文档是关于该主题的官方文字。

Though, a simple walkthrough would be something like: 虽然,一个简单的演练将是这样的:

Add a new model version: 添加新的模型版本:

在此输入图像描述

Modify the new model version to your tastes, then make sure it's set as the current model in the inspector of the root file. 根据您的喜好修改新模型版本,然后确保将其设置为根文件的检查器中的当前模型。

在此输入图像描述

Make a mapping model so that it knows how to migrate the data to the new model: 创建映射模型,以便它知道如何将数据迁移到新模型:

在此输入图像描述

Choose the corresponding models (source/destination) and edit the generated mapping model to your tastes (often it requires no changes at all if your changes aren't complex). 选择相应的模型(源/目标)并根据您的喜好编辑生成的映射模型(如果您的更改不复杂,通常不需要任何更改)。

That's a simplified/stripped down walkthrough but it's a start. 这是一个简化/简化的演练,但它是一个开始。 Read up on it! 阅读它!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM