Unable to remove notification number in badge when enter app

Hi! I have recently added the functionality of notifications in my app. I can send notifications and I see them in my phone well. The problem is that even if I have no notifications, the badge shows I have 3 and I can not remove this notification when I read the notifications. What it is strange is that even if I send new notifications, the number 3 is still there...

Replies

The badge number being set, incremented/decremented, or removed is not automatic. You have to change the number either by setting the badge number in the notification or in code by calling UIApplication.shared.applicationIconBadgeNumber = n

The badge is removed by setting the badge count to zero. You would do that by using UIApplication.shared.applicationIconBadgeNumber = 0 when the notifications are read, or whenever you want the badge to be removed.