-->

CKFetchNotificationChangesOperation sometimes does

2020-02-07 02:13发布

问题:

CKFetchNotificationChangesOperation returns INSERT operations, but UPDATE and DELETE, not always. DELETE, UPDATE worked last when I submitted app to App Store, but now not anymore. Why? I have created subscriptions like:

let s = CKSubscription(recordType: recordType, predicate: NSPredicate(value: true), options: .FiresOnRecordCreation | .FiresOnRecordUpdate | .FiresOnRecordDeletion)
s.notificationInfo = CKNotificationInfo()
subscriptionsToSave.append(s)

Dashboard shows all tree triggers:

I do not use any alertBody, so notification is a so called silent notification, can it be the cause?

In CloudKit Tips and Tricks lecturer says that subscription needs APS capability for app ID turned on from the developer portal. I don't think I have, but I just want fetch notifications, push only if this works.

Background capabilities? - same

Need to set up APS environment key in app's info plist. - I guess I have it.

回答1:

I know this question is old, but for those Googling, be sure to check out this thorough post on the inconsistency of notifications:

Silent pushes not delivered to the app on iOS 11

I found a particularly subtle fix that I mention here.