I'm working on a multiplatform app using Xcode and SwiftUI. A couple weeks ago I changed my CloudKit data and now the application won't run as I'm getting a fatalError. I got the iOS application running again by uninstalling the app and running Xcode so it installs it fresh. I can't figure out how to uninstall my macOS version so I can't run it anymore. Does anyone know how to fix this?
Fatal error: Unresolved error Error Domain=NSCocoaErrorDomain Code=134140 "Persistent store migration failed, missing mapping model."
I've found where the application is created (in the Debug directory ultimately within my app's Build directory) and removed them all but when run the newly created application has the same error. I also removed the entire app directory within Xcode/DerivedData
and I still got the fatalError.
Thanks
CodePudding user response:
This should emphasize the importance of proper migration and non-stop testing once you go into production. But a couple of things that can help.
Go to Settings>Apple ID>iCloud Drive>Options>Deselect Your app
Go to Settings>Apple ID>Manage Button (Bottom iCloud Storage)> Click on your App> Delete All Files
If this doesn't work try destroying the store Mock Core Data object in SwiftUI Preview
Here are some links with additional information. It is something delicate that you should be very aware of because a user loosing all their data is a terrible experience.
Good to know info
https://www.grantgrueninger.com/2020/01/nspersistentcloudkitcontainer-in-production/
Deploying to production, limitations, etc.
Lightweight Migration https://developer.apple.com/documentation/coredata/using_lightweight_migration