3

I have a CloudKit app on iOS 11.4.1 with frequent record updates through CKSubscriptions. I've found that there's a limit to the # of push notifications received before the device stops receiving any notifications for an extended period (30 mins to 2 hours).

Has anyone encountered this issue? The app is active and receives push notifications from CKSubscriptions just fine, but after 30-40 notifications within the span of 3-5 minutes, it just stops receiving them.

The didReceiveRemoteNotification is not even called. I have the activityIndicator activated during a call. I also call the completionHandler(.newData) for each didReceiveRemoteNotification.

After about 30 mins to 2 hours later (app is always active), didReceiveRemoteNotification starts getting called again with record changes.

Am I approaching some limit for push notifications with CKSubscriptions?

I've thoroughly tested this, and it doesn't have to do with internet connectivity since the device can still send updates to CloudKit, but no push notifications are received.

What I've tried: 1) Throttling my save CKRecords method, so that the records are saved in a batch. Unfortunately, didReceiveRemoteNotification is called once for each record change so same problem. 2) Occurs in both Development and Production (downloaded from App Store) environments 3) abort() and reopening the app doesn't work 4) Tried Apple's CloudShares sample app. I couldn't add many records myself, but when the push notifications were paused on my app, the CloudShares app still received push notifications. 5) Finally, I've tried a counter on the didReceiveRemoteNotification method (without calling any data update methods), and it went to about 80-95 before stopping.

Thanks!

powertoold
  • 1,593
  • 13
  • 19
  • Did you look into `CKFetchNotificationChangesOperation` and its MarkAsRead operation? Maybe the rate limit is lifted incase you use that or if its not you can guess at the ratelimit and once you calculate that you get near it you can use the operation above every few minutes. – Fabian Aug 14 '18 at 08:57
  • Thanks, CKFetchNotificationChangesOperation is actually deprecated https://developer.apple.com/documentation/cloudkit/ckfetchnotificationchangesoperation . These CloudKit remote notifications are also silent notifications, just to notify of record changes. – powertoold Aug 14 '18 at 16:10
  • I don‘t see how you can avoid the deprecated APIs(if they so work for your case) since I do not see any replacements for them. At least they just got Depracated in iOS12 and so will still work several more iOS versions. I think the only problem is that they are sometimes a little unreliable, but putting two unreliable features behind each other incase one does not work makes the whole thing a lot more reliable if integrated right. I don‘t think it matters whether they are silent or not. Maybe MarkAsRead is for sth badge-related and so not necessary? Dunno. – Fabian Aug 14 '18 at 16:29
  • Thanks for your help. I think CloudKit is still not a reliable API right now. It seems Apple is changing and deprecating methods every release. The fetch record changes method has been changed with every release since iOS 10 lol https://developer.apple.com/documentation/cloudkit/ckfetchrecordzonechangesoperation – powertoold Aug 15 '18 at 14:40
  • I‘m lazily looking at alternatives too. What would you suggest instead? – Fabian Aug 15 '18 at 14:59
  • I've avoided this issue by only subscribing to a "CloudUpdated" record and only updating that record every 10-20 seconds, to reduce the number of remote notifications. – powertoold Aug 16 '18 at 04:17

0 Answers0