Post

Replies

Boosts

Views

Activity

Reply to CloudKit Sharing Not Working with Other Apple IDs (SwiftData + SwiftUI)
Hi Ziqiao, Thanks for your detailed reply – and you’re absolutely right. You’re correct that the .shared option in ModelConfiguration(cloudKitDatabase:) isn’t supported and doesn’t compile. I had initially hoped it might be possible based on how .automatic behaved for syncing within the same Apple ID, but now I understand the limitation more clearly. So to clarify: • The sharing that “worked” was actually just syncing across devices with the same Apple ID using the private CloudKit DB. • When testing across multiple Apple IDs, it failed with the well-known “Bad Container” and CKShare-related errors. • After discussing with DTS, I’ve started converting the app to Core Data + CloudKit + Sharing, using UICloudSharingController and manual CKShare handling. The full transition is still in progress, but I’m hopeful that this approach will finally allow working sharing between different iCloud accounts. Thanks again for your support — it really helps to get direct feedback on what’s supported and what’s not. Best regards, Sebastian
Jul ’25
Reply to CloudKit Sharing Not Working with Other Apple IDs (SwiftData + SwiftUI)
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
Jul ’25