macOS, Xcode, Ventura: When CloudKit Stops Syncing

(This is for future reference, when this sort of problem arises again.)

Last spring I started working on a pair (macOS, iOS) of personal utility applications. They relied on CloudKit storage. For months they worked well together. Then, as soon as I updated to macOS 13 Ventura, they stopped syncing.

Symptoms

I fired up Xcode to try to diagnose the problem. But when run under Xcode, the app synced without issue.

I made an archive build for the macOS run destination. When I ran the resulting app, the problem returned.

/Application/Utilities/Console showed messages for the archive build that indicated a missing entitlement, one for reading a CloudKit preferences file. But I couldn't figure out where the file resided.

I turned off App Sandbox for the app. The resulting archive build was able to sync again.

Solution

Another user of the Apple Developer Forums had encountered the same problem. A couple of weeks later, they posted the solution:

CloudKit.framework has to be included in the app target's "Frameworks, Libraries, and Embedded Content" section.

Huh. I could have sworn I added that framework when I created the project as a CloudKit-hosted, Core Data project.

New project settings for Core Data + CloudKit

Sure enough,CloudKit.framework was not in the list of frameworks.1

I added it, and reverted the app to use the App Sandbox. Now it is sycing successfully. Many thanks to mjmsmith!


  1. It's odd that Xcode didn't add it, considering the options I'd selected for the new project.