Delete icon number when canceling local notification

I am developing a reminder application. I am using local notification. It is working fine. But the icon number is always displayed on top of the icon of my application. How to delete icon number after running local notification? When I put [UIApplication sharedApplication].applicationIconBadgeNumber = 0;in the completion of the launch, the icon number is completely deleted.

+5
source share
3 answers

I assume that you are trying to remove the badge badgeNumberfrom the badge of the badge and only show the badge badge of the blank (without any number) badge. You cannot just remove only the icon number from the icon icon. If you set applicationIconBadgeNumberto 0, the icon icon will be removed from the application icon.

If the icon is shown, then there should be a number, not 0. 0it makes sense to remove the badge icon.

+6
source

Whenever the didReceiveLocalNotification Method Fired delegate "Dismissal in the application" you can reduce the count and add one when adding a new notification.

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {

    [UIApplication sharedApplication].applicationIconBadgeNumber=application.applicationIconBadgeNumber-1;
}

Greetings

+6
source

, :

LocalNotification 0, IconBadgeNumber. IconBadgeNumber -1.

    UILocalNotification *localSilentNotif;
    localSilentNotif.applicationIconBadgeNumber = -1;
+2
source

All Articles