0

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

Asperi
  • 228,894
  • 20
  • 464
  • 690
Kyra
  • 5,129
  • 5
  • 35
  • 55

1 Answers1

1

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.

https://developer.apple.com/documentation/coredata/mirroring_a_core_data_store_with_cloudkit/creating_a_core_data_model_for_cloudkit

Lightweight Migration https://developer.apple.com/documentation/coredata/using_lightweight_migration

lorem ipsum
  • 21,175
  • 5
  • 24
  • 48
  • Thank you SO much. The first part didn't help, my app wasn't in the iCloud storage, BUT the destroying the store worked. Thank you. Yeah my app is in early development so I figured it didn't matter. Will be more careful once in production. Thanks for the information at the bottom. Adding it to my todo reading. :) – Kyra Jul 23 '22 at 21:54