Thanks a lot, Ziqiao, for your quick response.
You’re absolutely right – I now realize that .shared CloudKit containers are not yet supported with SwiftData.
In my implementation, I attempted to use a SwiftData model with a ModelContainer(for:sharing:) configuration and used UICloudSharingController to manage sharing between Apple IDs.
The ModelContainer was configured like this:
@main
struct FoodGuardApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
.modelContainer(for: FoodItem.self, configurations: [
ModelConfiguration("Default", cloudKitDatabase: .shared)
])
}
}
The sharing worked locally (between users in the same Apple ID), but failed when another Apple ID accepted the share, producing this error:
CKError: "Bad Container" (5/1014)
"Couldn't get container configuration from the server for container iCloud.com.de.seki.FoodGuard"
Based on your reply and DTS confirmation, I now plan to migrate my project to Core Data + CloudKit, using NSPersistentCloudKitContainer and UICloudSharingController.
Thanks again – your comment helped clarify things!
Best regards,
Sebastian
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: