Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lightweight CoreData Migration with CloudKit

Does Core Data handle simple data-model additions like a new attribute w/out any further "help" from me? In my case, I have an app that uses Core Data for varius things related to a users profile. I have an existing data-model entity called Profile that I want to add 2 new attributes to:

hasPublished: Boolean

lastDetail: String

So, does this cover my case? I'm not re-naming anything, just adding.

One more caveat, I'm using a NSPersistentCloudKitContainer as info can be shared across the users devices.

like image 925
TheTwoNotes Avatar asked Jan 24 '26 05:01

TheTwoNotes


1 Answers

Yes it can handle, but there is some little work from your side.

  1. You need to create new version of Core Data model.
  2. Call initializeCloudKitSchema() so changes are uploaded to CloudKit.
  3. Don't forget to deploy changes to production from CloudKit dashboard.
  4. Remove initializeCloudKitSchema() when deploying your app to AppStore.
like image 126
Stamenkovski Avatar answered Jan 25 '26 17:01

Stamenkovski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!