Hi everyone,
I’m currently developing a SwiftUI app that uses SwiftData with CloudKit sharing enabled. The app works fine on my own Apple ID, and local syncing with iCloud is functioning correctly — but sharing with other Apple IDs consistently fails.
Setup:
- SwiftUI + SwiftData using a
ModelContainer
with.shared
configuration - Sharing UI is handled via
UICloudSharingController
- iCloud container:
iCloud.com.de.SkerskiDev.FoodGuard
- Proper entitlements enabled (
com.apple.developer.icloud-services
,CloudKit
,com.apple.developer.coredata.cloudkit.containers
, etc.) - Automatic provisioning profiles created by Xcode
Error:<CKError 0x1143a2be0: "Bad Container" (5/1014); "Couldn't get container configuration from the server for container iCloud.com.de.SkerskiDev.FoodGuard">
What I’ve tried:
- Verified the iCloud container is correctly created and enabled in the Apple Developer portal
- Checked bundle identifier and container settings
- Rebuilt and reinstalled the app
- Ensured correct iCloud entitlements and signing capabilities
Questions:
- Why does CloudKit reject the container for sharing while local syncing works fine?
- Are there known issues with SwiftData
.shared
containers and multi-user sharing? - Are additional steps required (App Store Connect, privacy settings) to allow sharing with other Apple IDs?
Any advice, experience, or example projects would be greatly appreciated. 🙏
Thanks!
Sebastian
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