SwiftData: Unable to find a configuration named 'default' in the specified managed object model

I have a SwiftUI + SwiftData (with iCloud) app. The setup code is standard, with schema migrations (mostly lightweight, one custom). Everything works correctly except in one scenario.

When I run a newer version of the app (with an updated schema adding one field + migration) on a device with the previous data container (the usual app version update through TestFlight), I encounter an issue on the first launch. The app crashes on the first "cold" start but runs successfully on subsequent launches.

The error I receive on the first run is:

addPersistentStoreWithType:configuration:URL:options:error: returned error NSCocoaErrorDomain (134060)

NSLocalizedFailureReason : Unable to find a configuration named 'default' in the specified managed object model.

What might be a problem and how to resolve it?

Answered by DTS Engineer in 797908022

This is a known bug and should have been fixed in iOS 18 beta 3 and later. If you still see the issue in the current latest public beta, I’d suggest that you file a feedback report for the SwiftData folks to investigate.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Accepted Answer

This is a known bug and should have been fixed in iOS 18 beta 3 and later. If you still see the issue in the current latest public beta, I’d suggest that you file a feedback report for the SwiftData folks to investigate.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Is there a workaround?

I need to do something to be able to release the app to AppStore (iOS app got approved, but macOS is rejected). I don't know the review process, but maybe they run it couple of times and every time is a "cold" start. Any suggestions?

SwiftData: Unable to find a configuration named 'default' in the specified managed object model
 
 
Q