开发者

iOS, Core Data, update datamodel - How does it work?

Preambule

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, w开发者_运维知识库hich i later will update. I want to sell my books via the "In App Purchase".

Question

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.

See: Core Data Model Versioning and Data Migration Programming Guide

... 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜