Post

Replies

Boosts

Views

Activity

Difference in behavior between setBadgeCount and applicationIconBadgeNumber
Hi, I have a question regarding the badge in push notifications. I am implementing the following code to set the badge to 0 in order to remove it from the app: swift if #available(iOS 16, *) { let center = UNUserNotificationCenter.current() center.setBadgeCount(0) } else { application.applicationIconBadgeNumber = 0 } When I call setBadgeCount(0), the badge disappears, but the notifications in the Notification Center remain. On the other hand, when I call application.applicationIconBadgeNumber = 0, the badge disappears and all notifications in the Notification Center are cleared. Additionally, if no badge is displayed, calling application.applicationIconBadgeNumber = 0 does not clear the notifications in the Notification Center. Is this behavior expected? If it is expected, is there a way to call setBadgeCount(0) and clear all notifications in the Notification Center? Also, is there a way to call application.applicationIconBadgeNumber = 0 without clearing the notifications in the Notification Center?
2
0
606
Jun ’24