Badge value with CKQuerySubscription

Hi,


I've a CKQuerySubscription to monitor specific changes in the public database.

I've set the notificationInfo.shouldBadge = true to increment the badge value whenever the corresponding push notification is delivered.

However, I couldn't find a way to decrement the badge value as the notification is read.


Since iOS 11, both CKMarkNotificationsReadOperation and CKModifyBadgeOperation are deprecated, but the documentation doesn't specify a replacement.


How can I mark the notification as read and decrement the badge value?


Thanks.

Replies

When you mark the notification as read, do it yourself with:

            [[UIApplication sharedApplication] setApplicationIconBadgeNumber:badgeNumber];

The issue is that setApplicationIconBadgeNumber: doesn't modify the subscription's badge value.


For example, if the current badge value is 2, I set the badge value to 0 with setApplicationIconBadgeNumber:, and I receive another push notification, the badge value will be 3, not 1.

I see the difference. Do you know whether the badge value is actually retained by the subscription or whether the badge value is just 'incremented by 1' by the subscription notification. If the later, my work around would work.

Unfortunately, the badge value is retained by the subscription. Every time a change that matches the predicate occurs, its value is incremented.

So for the future we need to inform Apple through the bug reporter that they need to duplicate or not deprecate this function.

I submited a sugestion to Apple with regards to this because there is no known solution to it for now.Or at least I couldnt find any.

any update on this?