Hi everyone,
I have a SwiftUI app using CKQuerySubscription on the public database for social notifications (friend requests, recommendations, etc.). Push notifications work perfectly in the Development environment but never fire in Production (TestFlight).
Setup:
- iOS 26.4, Xcode 26, Swift 6
- Container: public database, CKQuerySubscription with
.firesOnRecordCreation - 5 subscriptions verified via
CKDatabase.allSubscriptions() registerForRemoteNotifications()called unconditionally on every launch- Valid APNS device token received in
didRegisterForRemoteNotificationsWithDeviceToken - Push Notifications + Background Modes (Remote notifications) capabilities enabled
What works:
- All 5 subscriptions create successfully in Production
- Records are saved and queryable (in-app CloudKit fetches return them immediately)
- APNS production push works — tested via Xcode Push Notifications Console with the same device token, notification appeared instantly
- Everything works perfectly in the Development environment (subscriptions fire, push arrives)
What doesn't work:
- When a record is created that matches a subscription predicate, no APNS push is ever delivered in Production
- Tested with records created from the app (device to device) and from CloudKit Dashboard — neither triggers push
- Tried: fresh subscription IDs, minimal NotificationInfo (just alertBody), stripped shouldSendContentAvailable, created an APNs key, toggled Push capability in Xcode, re-deployed schema from dev to prod
Additional finding:
One of my record types (CompletionNotification) was returning BAD_REQUEST when creating a subscription in Production, despite working in Development. Re-deploying the development schema to production (which reported "no changes") fixed the subscription creation. This suggests the production environment had inconsistent subscription state for that record type, possibly from the type being auto-created by a record save before formal schema deployment.
I suspect a similar issue may be affecting the subscription-to-APNS pipeline for all my record types — the subscriptions exist and predicates match, but the production environment isn't wiring them to APNS delivery.
Subscription creation code (simplified):
let subscription = CKQuerySubscription(
recordType: "FriendRequest",
predicate: NSPredicate(format: "receiverID == %@ AND status == %@", userID, "pending"),
subscriptionID: "fr-sub-v3",
options: [.firesOnRecordCreation]
)
let info = CKSubscription.NotificationInfo()
info.titleLocalizationKey = "Friend Request"
info.alertLocalizationKey = "FRIEND_REQUEST_BODY"
info.alertLocalizationArgs = ["senderUsername"]
info.soundName = "default"
info.shouldBadge = true
info.desiredKeys = ["senderUsername", "senderID"]
info.category = "FRIEND_REQUEST"
subscription.notificationInfo = info
try await database.save(subscription)
Has anyone encountered this? Is there a way to "reset" the subscription-to-APNS pipeline for a production container?
I'd really appreciate any guidance on how to resolve and get my push notifications back to normal.
Many thanks,
Dimitar - LaterRex