zdolniacha zdolniacha - 1 year ago 81
Objective-C Question

Clear notifications badge without removing notifications

In my app, I'm receiving push notifications with badge number set to one.
When app will start, it should set badges count to 0, so I'm using:

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];

And it works, but also it removes all notifications from notifications center.

Is there a way to clear badges without removing notifications?

Answer Source

According to this topic:

How to clear badge number while preserving notification center


[[UIApplication sharedApplication] setApplicationIconBadgeNumber:-1];

should do the trick.