Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode Preview crashes because of RealmSwift model changes

I am developing an app with SWIFTUI, RealmSwift and Xcode 12.4 Along with development, Realm data model changes, eg. some values are removed, some are added...

When I make changes on the data model, I simply delete my app on my device and re-install it to avoid crash derived from Realm migration issue. Now the problem is, Xcode Preview crashes because of the same migration issue and I have no idea how to do a fresh re-build for the Xcode Preview.

Below is the DiagnosticReports Xcode gave me.

Migration is required due to the following errors:

  • Property 'A' has been removed.
  • Property 'B' has been added.

Realm migration for a Preview? It doesn't make sense!

I tried cleaning build, deleting derived data, reboot... without luck. There should be some way to handle Realm model changes for Preview provider.

Please somebody guide me what should I do to get my Preview back.

like image 799
Vincent Gigandet Avatar asked Oct 17 '25 11:10

Vincent Gigandet


1 Answers

I soloved my problem based on this forum.

I got my XCode Preview back.

Seems like Core Data has similar sort of issue of mine.

To start from a fresh slate you can use the terminal app and run xcrun simctl --set previews delete all

like image 190
Vincent Gigandet Avatar answered Oct 20 '25 03:10

Vincent Gigandet



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!