sample code
let modelConfiguration = ModelConfiguration()
// 1. create mom
guard let mom = NSManagedObjectModel.makeManagedObjectModel(for: [Attachment.self]) else {
fatalError("====> makeManagedObjectModel error")
}
// 2. create description with config url and setting
let description = NSPersistentStoreDescription(url: modelConfiguration.url);
description.shouldAddStoreAsynchronously = false;
container = NSPersistentCloudKitContainer(name: "swiftDataCloudTest", managedObjectModel: mom);
container.persistentStoreDescriptions = [description]
// 3. get modelContainer
let modelContainer = try! ModelContainer(for: Attachment.self, configurations: self.modelConfiguration)
this code works fine on MacOS(14.4.1) and previous iOS 17.x.(iOS 17.2 is OK)
but on iOS 17.5, the app crashes with message
A Core Data error occurred." UserInfo={NSLocalizedFailureReason=Unable to find a configuration named 'default' in the specified managed object model
how can I fix these?
5
0
1.3k