如何清除的iOS推送通知徽章计数? [英] How to clear push notification badge count in iOS?

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

问题描述

我要清除的推送通知徽章计算一次应用是launched.Im不清楚的地方设置C $ C.请下面的$给予简要说明有关清除徽章计数。

  [UIApplication的sharedApplication] .applicationIconBadgeNumber = 0;


解决方案

您应该将此 [UIApplication的sharedApplication] .applicationIconBadgeNumber = 0;
或者,如果应用程序启动并发送至后台,那么你推出 didFinishLaunchingWithOptions 方法将不会被调用,所以使用了上述两种方法的应用这些方法的AppDelegate

   - (无效)applicationWillEnterForeground:(UIApplication的*)的应用
- (无效)applicationDidBecomeActive:(UIApplication的*)的应用

I want to clear the push notification badge count once app is launched.Im not clear where to set the below code.Please give brief description about clearing the badge count.

[UIApplication sharedApplication].applicationIconBadgeNumber = 0;

解决方案

You should set this [UIApplication sharedApplication].applicationIconBadgeNumber = 0; in either of these AppDelegate methods if the application is launched and sent to background then you launch the application didFinishLaunchingWithOptions method will not be called so use either of these methods

- (void)applicationWillEnterForeground:(UIApplication *)application


- (void)applicationDidBecomeActive:(UIApplication *)application

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

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