I'm having the same "Cannot use staged migration with an unknown model version." error for my app on production.
I started with an unversioned SwiftData model with iCloud, then released a new version for my app that puts the same model inside of V1 and also have a lightweight migration to V2. Now, all the users are complaining about the crash on launch. I spent a day to find a solution for the issue but unfortunately the only solution is deleting the app and installing it again.
Looks like Apple is not willing to admit this issue and fix it. Therefore, I highly suggest people who use SwiftData to start with versioned schema. Or if you already shipped an unversioned schema, first put your model into a versioned schema and release a new build for your app. Wait for most of your users to update to that build. Then, create another release that includes your migration. These are the only ways to avoid the crash on launch. It is good that I used iCloud so nobody lost their data.
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: