Ibolit
Ibolit

Reputation: 9720

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, which 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?

Upvotes: 0

Views: 3689

Answers (1)

TechZen
TechZen

Reputation: 64428

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.

Upvotes: 2

Related Questions