Sandboxed macOS app using SwiftData and CloudKit cannot initialize CloudKit mirroring.

I have a Mac and iOS app intended to sync data in iCloud. Both apps in TestFlight, the iOS reads and writes to iCloud but the Mac fails as the App Sandbox denies mach-lookup com.apple.cloudd, so NSCloudKitMirroringDelegate` never reaches the daemon and setup fails permanently. I have a minimal app reproducing the issue on for the Mac app. I also submitted a feedback FB24450529

Answered by DTS Engineer in 902926022

This issue was discussed in this thread. The workout 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. Please give it a try and share if that helps.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Accepted Answer

This issue was discussed in this thread. The workout 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. Please give it a try and share if that helps.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Sandboxed macOS app using SwiftData and CloudKit cannot initialize CloudKit mirroring.
 
 
Q