I use
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:[UIApplication sharedApplication].applicationIconBadgeNumber -1];
to decrement the icon badge count, but actually it gets cleared. when I press the home button, the badge count is not there.
BUT, if I try a fixed value like this
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:4];
, the badge count is there as expected.
So, the question is: Why is
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:[UIApplication sharedApplication].applicationIconBadgeNumber -1];
not working?
Why you don't just:
NSInteger numberOfBadges = [UIApplication sharedApplication].applicationIconBadgeNumber
numberOfBadges -=1;
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:numberOfBadges];
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