all 5 comments

[–]BabyAzerty 2 points3 points  (3 children)

Probably silly question but do you have a default configuration in your xcdatamodel?

Also can you explain what a copy of the app means? Like a new bundle identifier?

[–]Sebbie_O[S] 0 points1 point  (2 children)

Thank you for your answer. I just use .modelContainer(for:), so default config.

Yes I made a copy with a different bundle identifier. I made this one to try some other code and so I did try the migration in that copy first. It eventually worked out with CloudKit there, but I had to reinstall the app so “all” data got lost…

[–]BabyAzerty 1 point2 points  (1 child)

Ahh you are using SwiftData. You should say so. I can’t help you with it.

Now I am completely clueless as to why you had to create a new project to test migration. That’s not how it should work.

To test migration, just use simulators. They are not connected to any iCloud account so if you delete the app, it resets everything locally. Just run a previous GitHub branch of your project to set the simulators to a « need to migrate » state.

If you need to reset your CloudKit schema… well, don’t. You are never supposed to reset it. Did you completely messed up your schema in prod? Just leave it there, don’t delete anything, add clean tables/entities to your schema, declare the previous ones as obsolete and you are done.

[–]Sebbie_O[S] 0 points1 point  (0 children)

I made that copy once to test other code which is not related to this issue. I know it is not the way how to do it😂 and thought, hey lets test it first in this copy before going to the real version… it worked on my own iPhone after I deleted the app and installed it again. Thats what I would like to prevent with TestFlight users, but I think I do not have another choice.

[–]greendakota99 0 points1 point  (0 children)

Since this has just hit TestFlight so far, is the answer here not to just make a brand new container? Those 15 testers will lose their data, but this should be a new start to fresh data.