简体   繁体   English

重置或清除iOS应用徽章,而无需进行任何应用交互,例如打开应用或推送通知

[英]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.

相关问题 如何在iOS应用程序上使用PushWoosh重置推送通知徽章计数器 - How to reset push notification badge counter with PushWoosh on an iOS app 在不运行应用程序或不发送推送通知的情况下为iOS应用程序添加徽章? - Badge iOS application without running the app or sending a push notification? 重置iOS应用徽章 - Reset iOS app badge 是否可以在不通过iOS中的推送通知打开应用程序的情况下更新应用程序图标上的徽章编号? - Is it possible to update badge number on app icon without openining app on push notification in iOS? 推送通知-应用徽章图标 - Push Notification - App Badge Icon 在App未打开时收到推送通知时更新徽章编号 - Update Badge Number when push notification is received when App is not Open 打开应用程序而无需对推送通知进行任何操作 - Open an app without any action over push notification IOS 应用程序中未收到 Firebase 推送通知徽章计数 - Firebase push notification badge count is not being received in IOS app Phonegap 3.0及更高版本-是否有无需更新通知即可更新应用程序徽章的插件? - Phonegap 3.0 and newer - Is there a Plugin to Update the App Badge without a Push Notification? 在不显示推送通知的情况下增加应用徽章数量 - Increasing App badge count without showing push notification
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM