[英]Reset or clear iOS app badge without any app interactions like open the app or push notification
Any possibility to reset/clear app badge without any app interactions such as opening the app or any push/local notifications. 在没有任何应用程序交互(例如打开应用程序或任何推送/本地通知)的情况下,任何重置/清除应用程序徽章的可能性。 My need is, I want to reset my app badge starting off every day without even opening the app or with any notifications.
我需要的是,我想每天从头开始重置应用程序徽章,甚至不打开应用程序或收到任何通知。
您可以将本地通知安排在一天结束时的徽章计数等于0。请检查此内容,以在没有推送通知的情况下更新iOS徽章
I solved this problem with the help of this solution . 我借助此解决方案解决了这个问题。 The working code is:
工作代码为:
UILocalNotification* localNotification = [[UILocalNotification alloc] init];
NSCalendarUnit unitDay = NSCalendarUnitDay;
localNotification.repeatInterval = unitDay;
localNotification.fireDate = fireDate;
localNotification.applicationIconBadgeNumber = -1;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
Local notification has no alertBody
, so local notification will not display upfront. 本地通知没有
alertBody
,因此本地通知不会预先显示。 If need to show alertBody
then add localNotification.alertBody = @"Your notification alertBody";
如果需要显示
alertBody
则添加localNotification.alertBody = @"Your notification alertBody";
. 。
Thanks for the answer. 感谢您的回答。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.