Anyone successfully able to add two or more ModelConfigurations to a ModelContainer?
DESCRIPTION OF PROBLEM:
When you create two ModelConfigurations for two different models and combine them into one ModelContainer, it seems the @Query fails to find the models.
Crashes app with error:
“Thread 1: "NSFetchRequest could not locate an NSEntityDescription for entity name 'NumberModel'"
STEPS TO REPRODUCE
1 - Create a new iOS project.
2 - In ContentView.swift add this code:
import SwiftData
import SwiftUI
struct ContentView: View {
@Query private var colors: [ColorModel]
@Query private var numbers: [NumberModel]
var body: some View {
List {
ForEach(colors) { color in
Text(color.name)
}
ForEach(numbers) { number in
Text(number.name)
}
}
}
}
#Preview {
ContentView()
.modelContainer(for: [ColorModel.self, NumberModel.self])
}
3 - In App file, add this code:
import SwiftData
import SwiftUI
@Model
class ColorModel {
var name: String = ""
init(name: String) {
self.name = name
}
}
@Model
class NumberModel {
var name: String = ""
init(name: String) {
self.name = name
}
}
@main
struct MultipleModelConfigsApp: App {
private var container: ModelContainer
init() {
do {
let config1 = ModelConfiguration(for: ColorModel.self)
let config2 = ModelConfiguration(for: NumberModel.self)
let container = try ModelContainer(
for: ColorModel.self, NumberModel.self,
configurations: config1, config2
)
self.container = container
} catch {
fatalError("ModelContainer creation failed.")
}
}
var body: some Scene {
WindowGroup {
ContentView()
.modelContainer(container)
}
}
}
4 - Now run the app and observe the crash and the error stated above.
VERSION OF XCODE
Version 15.1 (15C65)
FEEDBACK REPORT
FB: FB13504577
(Xcode project attached to FB)
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
The Foundation Models Framework stopped working after Xcode failed to download the "Predictive Code Completion Model".
What happened was on macOS Tahoe 26.0:
Downloaded and installed Xcode 26 Beta (17A5241e)
Worked with Foundation Models framework. Everything worked fine. ✅
Opened Xcode 16.4
This triggers the downloading of Predictive Code Completion Model which then fails.
Go back into Xcode 26 Beta, Foundation Models framework no longer works. ❌ Error: "Failed to find asset: com.apple.gm.safety_deny.input.code_intelligence.base.generic - no asset"
What I've tried or checked:
Reinstalling Xcode 26 Beta
Uninstalling both Xcodes and only installing Xcode 26 Beta
Checked available space on drive (over 300 GB free)
Restarted Mac
Restarted Xcode 26
Changed wifi networks
Turned on VPN
Deleted the Library > Developer > Xcode folder and reinstalled Xcode 26
Feedback Report
FB18208139: Can't download Predictive Code Completion Model - Xcode 26
Screenshots
Topic:
Developer Tools & Services
SubTopic:
Xcode