清除通知徽章而不删除通知 [英] Clear notifications badge without removing notifications

查看:122
本文介绍了清除通知徽章而不删除通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用中,我收到徽章编号设置为1的推送通知。
当应用程序启动时,它应该将徽章数设置为0,所以我使用:

In my app, I'm receiving push notifications with badge number set to one. When app will start, it should set badges count to 0, so I'm using:

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];

它有效,但它也会从通知中心删除所有通知。

有没有办法在不删除通知的情况下清除徽章?

And it works, but also it removes all notifications from notifications center.
Is there a way to clear badges without removing notifications?

推荐答案

根据这个主题:

如何清除保留通知中心时的徽章编号

设置:

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:-1];

应该这样做。

这篇关于清除通知徽章而不删除通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆