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.
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.
use this in application didfinshlaunchingwithoptions
application.applicationIconBadgeNumber = 0;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With