开发者

Removing the badge number when local notification is canceled

I'm developing a reminder app. I'm using local notification. It is working fine. But a badge number is always showing on top of my app's icon. How can I remove the badge number after firing the local notification? When I put [UIApplication shared开发者_开发技巧Application].applicationIconBadgeNumber = 0; in did finish launching, the badge number is completely removed.


I guess that you are trying to remove the badgeNumber from the badge icon and show only an empty(without any number) badge icon. You can not just remove the badge number alone from the badge icon. If you set applicationIconBadgeNumber to 0, the badge icon itself will be removed from the application icon.

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


Whenever The Notification Fired In App delegate didReceiveLocalNotification Method Fired You Can Decrease The Count By One And Add One When You Add New Notification.

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

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

Cheers


i try the same thing and i found this:

When the app in in the background and you try to set the LocalNotification to 0 it will not remove the IconBadgeNumber. you need to set the IconBadgeNumber to -1.

    UILocalNotification *localSilentNotif;
    localSilentNotif.applicationIconBadgeNumber = -1;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜