Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clear Application's badge Number

I have made local notification in iphone app. And set icon badge number.

All works good. But if i have two notification in tray and user clicks on clear button than notification deletes from tray.

But the badge number of icon remains same.

I want to set the badge number to zero.

Thanks.

like image 408
Priyank Gandhi Avatar asked Jul 31 '13 10:07

Priyank Gandhi


2 Answers

For Swift3, you can clear badge number in your application didFinishLaunchingWithOptions with this line :

UIApplication.shared.applicationIconBadgeNumber = 0

You can used this line in anywhere in code if you want too.

like image 99
Kevin ABRIOUX Avatar answered Sep 19 '22 17:09

Kevin ABRIOUX


use this in application didfinshlaunchingwithoptions

        application.applicationIconBadgeNumber = 0;
like image 36
Vishnu Avatar answered Sep 17 '22 17:09

Vishnu