CloudKit sync fails in macOS TestFlight build – sandbox denies com.apple.cloudd

I have a macOS SwiftUI app using SwiftData with CloudKit synchronization.

Bundle ID:
com.mjsapps.PhrasePin

CloudKit container:
iCloud.com.mjsapps.PhrasePin

CloudKit synchronization works when running the app from Xcode using the Development environment.

However, synchronization does not work in the TestFlight / Production build.

The Production schema has been deployed successfully. The TestFlight build has the expected entitlements, including:

  • com.apple.developer.icloud-container-environment = Production
  • com.apple.developer.icloud-container-identifiers = iCloud.com.mjsapps.PhrasePin
  • com.apple.developer.icloud-services = CloudKit
  • com.apple.security.app-sandbox = true
  • com.apple.security.network.client = true

The TestFlight build is signed as:

Authority=TestFlight Beta Distribution
Identifier=com.mjsapps.PhrasePin
TeamIdentifier=8D6TX86CQK

CloudKit/Core Data logging shows that the app is trying to use:

container=iCloud.com.mjsapps.PhrasePin:Production

but synchronization fails with:

CKErrorDomain Code=6
Error connecting to CloudKit daemon
NSCocoaErrorDomain Code=4099

The macOS sandbox log shows:

Sandbox: PhrasePin(...) deny(1) mach-lookup com.apple.cloudd

As a result, no com.apple.coredata.cloudkit.zone is created in the Production private database and no SwiftData records are synchronized.

The problem has been reproduced on:

  • macOS Sequoia 15.7.7
  • macOS Sequoia 15.7.9

The same app works with CloudKit in Development when run from Xcode.

I have already submitted a Feedback Assistant report, but have not received a response.

Has anyone seen this behavior with SwiftData + CloudKit in a sandboxed macOS TestFlight build? Is there an additional entitlement or provisioning requirement needed for access to com.apple.cloudd in Production?

The issue is pretty similar to what was discussed in this thread, and the workaround is to explicitly import the CloudKit framework and use any CloudKit type in your code to make sure the CloudKit framework is linked to your app, which allows your app to interact with cloudd. You can give it a try and share if that helps.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.