iOS,核心数据,更新数据模型-它如何工作? [英] iOS, Core Data, update datamodel - How does it work?

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

问题描述

Preambule

假设我有一个iOS应用程序,它是一个图书阅读器,它使用Core Data来存储图书数据.我的应用程序的第一个版本使用了一个相当简单的数据模型,稍后我将对其进行更新.我想通过应用内购买"出售图书.

Suppose, I have an iOS application, which is a book reader, and it uses Core Data for storing the books data. The first version of my app uses a rather simple data model, which i later will update. I want to sell my books via the "In App Purchase".

问题

如果我使用新的数据模型更新应用程序, iOS 应用程序将负责将旧书转换为数据模型的新版本吗?说, iPhone或iPad 是否必须进行转换?当用户购买旧版本的图书(在我的应用程序中)同时仍旧使用该应用程序时,我将如何激励他们将其应用程序更新到新版本?

If i update the application with a new datamodel, will the iOS application be responsible for converting the old books into a new version of the data model? Say, will the iPhone or iPad have to convert them? How will I motivate the users to update their apps to a new version when they buy books (in my app) in the new version, while still having an old version of the app?

推荐答案

要更新数据模型,请使用迁移.

To update the data model, you use migration.

请参阅:核心数据模型版本控制和数据迁移编程指南

...有关详细信息.请注意,在许多情况下,您可以依靠自动迁移.

... for details. Note that you can in many cases rely on automatic migration.

我将如何激励用户将他们的应用更新到新版本当他们在新版本,同时仍旧版本的应用程序?

How will I motivate the users to update their apps to a new version when they buy books (in my app) in the new version, while still having an old version of the app?

您不想激励用户"进行更新,因为这通常只是一种礼貌的方式,即强迫用户"进行更新.强迫您的用户升级其他产品不可避免的技术需求总是一个坏主意.

You don't want to "motivate the users" to update because that is usually just a polite way of saying "force the user" to update. Forcing your users to upgrade for anything other than unavoidable technical necessity is always a bad idea.

这篇关于iOS,核心数据,更新数据模型-它如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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