Yayo Yayo - 3 years ago 246
iOS Question

UNUserNotificationCenter not clean notification of icon app in swift 3?

I have a problem. I had a notification in my app. Im trying this. But now, i can't delete from the icon app.

I run this code:

UNUserNotificationCenter.current().getPendingNotificationRequests(completionHandler: {requests -> () in
print("\(requests.count) requests -------")
for request in requests{


UNUserNotificationCenter.current().getDeliveredNotifications(completionHandler: {deliveredNotifications -> () in
print("\(deliveredNotifications.count) Delivered notifications-------")
for notification in deliveredNotifications{


And trace is this:

0 requests -------
0 Delivered notifications-------

In the icon app, i see this:

Im can't up image :( but in this, i see a number one on the icon app and red foreground

Answer Source

Yayo you need to set badge count to 0 for removing badge count from your app icon. For that -

UIApplication.shared.applicationIconBadgeNumber = 0
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download