iPhone: how to remove badge after Push Notification?

obliviux picture obliviux · Nov 26, 2009 · Viewed 24.7k times · Source

What is the code to remove the badge on my app's icon? When I receive push, I need to remove it when a button is clicked!

Answer

Felixyz picture Felixyz · Nov 26, 2009

objC :

[UIApplication sharedApplication].applicationIconBadgeNumber = 0;

swift :

UIApplication.sharedApplication().applicationIconBadgeNumber = 0;