Clear app badge with local notifications

后端 未结 2 1545
醉酒成梦
醉酒成梦 2020-12-28 16:27

I\'m trying to clear my app\'s \"unread\" badge with a UILocalNotification. Logically you would think this would be done by setting applicationIconBadge

2条回答
  •  误落风尘
    2020-12-28 16:54

    Yes, it is possible to clear the badge from the app itself.

    I use the code below in one of my apps, and it works as expected (i.e. clears the badge):

    //clear app badge
    [UIApplication sharedApplication].applicationIconBadgeNumber=0;
    

提交回复
热议问题