Hi Guy, I have the same issue running on Xcode 12 and SwuiftUI with App life cycle over macOS Big Sur.
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'executeFetchRequest:error: A fetch request must have an entity.'
terminating with uncaught exception of type NSException
Post
Replies
Boosts
Views
Activity
Solutioned
In my case the solutions is that the context must be defined inside the struct App.
import SwiftUI
@main
struct CoreDataDemoApp: App {
private let context = CoreDataStack.context.
var body: some Scene {
WindowGroup {
ContentView()
.environment(\.managedObjectContext, context)
}
}
}