In my Swift app I had a data model which I needed to remodel.
After that, at the root level of my app, the code crashes when trying to load the ModelContainer, no matter what.
The error is a huge system report that starts with this:
addPersistentStoreWithType:configuration:URL:options:error: returned error NSCocoaErrorDomain (134110)
struct myApp: App {
init() {
do {
container = try ModelContainer(for: Role.self) //**ERROR HERE**
let context = ModelContext(container)
deleteData(context: context) //IRRELEVANT AT THIS TIME
insertHardcodedRoles(context: context) // IRRELEVANT AT THIS TIME
} catch {
fatalError("Failed to initialize ModelContainer: \(error)")
}
}
}
- Tried
deleteData(context:context)afterinsertHarcodedRoles(context: context)to make sure data was erased after loading. Didn't help. - Checked code integrity a couple of times, didn't help.
- Removed all data displaying views from being loaded, didn't help.
- Cleaned the Build Folder a couple of times, didnt help.
- Created a new schema, didn't help
- tried different simulating devices (iphone 15, iphone 15 pro etc.)
The container itself seems to have a problem. Apparently you can't "easily" alter your SwiftData model?