Clear app badge with local notifications

后端 未结 2 1546
醉酒成梦
醉酒成梦 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:47

    I had the same problem. When setting the badge from a local notification, setting it to 0 is the default for 'no change', while doing it straight from the application would clear it. Setting it to a negative number through a local notification solved the problem.

    try:

    clearEpisodeNotification.applicationIconBadgeNumber = -1;
    

提交回复
热议问题