Skip to main content

Posts

Showing posts with the label CloudKit

SwiftData CloudKit Sync Fails in TestFlight (But Works in Debug)

  You’ve spent weeks refining your SwiftData models. In the Simulator and on your local device hooked up to Xcode, the sync is instantaneous. You push the build to TestFlight, invite your beta testers, and suddenly, the data vanishes. No sync, no errors on the UI, just empty lists. Or worse, you check the logs and see cryptic   BAD_REQUEST   or   CoreData: error: CoreData+CloudKit   failures. This is the "Works on My Machine" paradox of the Apple ecosystem, and it almost always stems from the invisible wall between the CloudKit Development and Production environments. The Root Cause: Just-In-Time vs. Locked Schemas The issue is rarely your Swift code; it is how CloudKit handles schema evolution. The Development Environment (Debug Builds):  When you run your app via Xcode, you are targeting the CloudKit  Development  environment. This environment supports "Just-In-Time" (JIT) schema definition. If you add a new property  @Attribute var isFavor...