Posting here per DTS guidance (no reduced sample project available).
Creating a CKQuerySubscription on the PUBLIC database in the Production environment always fails, on a production-signed TestFlight build. It works in the Development environment; only Production rejects it.
Error: CKError 12 (invalidArguments); underlying "BadSyntax" (2006); server message = "attempting to create a subscription in a production container".
The subscription: let sub = CKQuerySubscription( recordType: "PublicSolution", predicate: NSPredicate(format: "%K == %@", "challengeAuthorID", myUserRecordName), subscriptionID: "MyChallengeSolved-<userRecordName>", options: [.firesOnRecordCreation]) let info = CKSubscription.NotificationInfo() info.shouldSendContentAvailable = true sub.notificationInfo = info try await container.publicCloudDatabase.save(sub)
Verified (all good):
- TestFlight build is distribution-signed: aps-environment = production (confirmed with codesign on the archive).
- APNs registration succeeds on device (valid token).
- CKContainer.accountStatus = .available; userRecordID resolves.
- Reads of PublicSolution succeed in Production.
- challengeAuthorID on PublicSolution is QUERYABLE in the deployed Production schema (verified in CloudKit Console).
- Dev and Production schemas are identical; deployed to Production multiple times (Console reports "no changes").
- Removing notificationInfo.desiredKeys made no difference.
- Push Notifications capability present; entitlement aps-environment = production.
Question: What makes Production reject this public-DB CKQuerySubscription create, and what container-side configuration allows it? Same code succeeds in Development.
Container: iCloud.JCM.Contraptor