ios - 在没有推送通知的情况下更新 iOS 角标(Badge)

标签 ios notifications

我见过一些待办事项应用程序会在午夜更新其应用程序角标(Badge),始终显示正确的到期任务数。他们这样做时没有使用推送通知 - 所以我的问题是:他们是怎么做到的?他们是否使用本地通知——如果是,当设备关闭时是否会调用这些通知?我有点困惑,希望能提供一些意见。

最佳答案

试试这个

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:1];

要通过本地通知执行此操作,您必须在 applicationIconBadgeNumber 中设置值

UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.applicationIconBadgeNumber = 1;// set here the value of badge

关于ios - 在没有推送通知的情况下更新 iOS 角标(Badge),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4861131/

相关文章:

ios - 在哪里调用函数 Fill Chart Array 以减少加载时间?

ios - Storyboard的多个入口点

android - 没有firebase的iOS和Android的Flutter推送通知?

ios - 如何处理来自应用程序委托(delegate)的 UIViewcontroller 中的通知?

ios - 显示 Coreplot 条形图值而不进行选择

ios - iOS 7上的BOOL vs.bool

ios - 如何使用 Core ML 3 的 `Linked Model` 特性?

android - 一次通知Compat

安卓通知: GCM or Service

java - 新的 Firebase 通知替换现有的未读 Firebase 通知