Post

Replies

Boosts

Views

Activity

Reply to SwiftData Fatal error: failed to find a currently active container
This happened to me on iOS 17.5 (it works fine on iOS 18). What I did was simply initialize the ModelContainer in the @main struct. The odd thing that I don’t use this contaner reference anywhere, but it does fix the crash issue let container: ModelContainer? init() { do { let config = ModelConfiguration(isStoredInMemoryOnly: true) container = try ModelContainer(for: ModelName.self, configurations: config) } catch { print("Failed to initialize ModelContainer: \(error)") container = nil } } usage: WindowGroup { } .modelContainer(for: ModelName.self) // please note that it should be the @Model name, not a ModelContainer.
Jan ’25
Reply to SwiftData Fatal error: failed to find a currently active container
This happened to me on iOS 17.5 (it works fine on iOS 18). What I did was simply initialize the ModelContainer in the @main struct. The odd thing that I don’t use this contaner reference anywhere, but it does fix the crash issue let container: ModelContainer? init() { do { let config = ModelConfiguration(isStoredInMemoryOnly: true) container = try ModelContainer(for: ModelName.self, configurations: config) } catch { print("Failed to initialize ModelContainer: \(error)") container = nil } } usage: WindowGroup { } .modelContainer(for: ModelName.self) // please note that it should be the @Model name, not a ModelContainer.
Replies
Boosts
Views
Activity
Jan ’25
Reply to "Final reminder: Answer the updated age ratings questions." But there are no questions
Hi, I have the same issue. I actually have the apps, but I’m not able to provide answers in the App Information question. Thanks, Anton
Replies
Boosts
Views
Activity
Dec ’25