ios – How to perform CoreData + CloudKit lightweight migration correctly without affecting user with old version of app?

0
47


Currently, I need to add new column/ new index to an entity.

I perform the following lightweight migration, with guideline from https://www.raywenderlich.com/7585-lightweight-migrations-in-core-data-tutorial

I also add versioning hash modifier, based on https://stackoverflow.com/a/3182301/72437

Lightweight migration, by generating another new version of xcdatamodel

enter image description here


Add versioning hash modifier

enter image description here


As per my testing, the SQLite file in my local was migrated without issue.

However, soon, I also need to deploy such new change to iCloud production based on Lightweight CoreData Migration with CloudKit

I was wondering, after I have deployed latest change to iCloud production server

  1. User with latest updated app, should be able sync to iCloud without issue, because latest app has the latest database schema.

But, what about users with old app? Will they face iCloud sync failure, data loss, app crashing issue, because their old database schema is incompatible with latest iCloud’s?

If so, what is the solution for such a situation?