I might have run in to the same problem, though I initially attributed it to the 27 beta of XCode / macOS (reported as FB23688931).
(This was with mostly the default SwiftUI + SwiftData + CloudKit template app, though I added the iCloud capability and enabled CloudKit. The app came with the “App Sandbox” capability configured by default).
After verifying the fix with the print(CKRecord.self) as suggested above, I worked around the issue by explicitly adding “CloudKit.framework” to the “Link Binary With Libraries” setting under “Build Phases” which also fixed the problem.
Topic:
App & System Services
SubTopic:
iCloud
Tags: