iOS application: how to clear notifications?

Posted willbin

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了iOS application: how to clear notifications?相关的知识,希望对你有一定的参考价值。

http://stackoverflow.com/questions/8682051/ios-application-how-to-clear-notifications

 

Just to expand on pcperini‘s answer. As he mentions you will need to add the following code to yourapplication:didFinishLaunchingWithOptions: method;

[[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0];
[[UIApplication sharedApplication] cancelAllLocalNotifications];

You Also need to increment then decrement the badge in your application:didReceiveRemoteNotification: method if you are trying to clear the message from the message centre so that when a user enters you app from pressing a notification the message centre will also clear, ie;

[[UIApplication sharedApplication] setApplicationIconBadgeNumber: 1];
[[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0];
[[UIApplication sharedApplication] cancelAllLocalNotifications];

以上是关于iOS application: how to clear notifications?的主要内容,如果未能解决你的问题,请参考以下文章

How to solve MB SD Connect C4 EPC application error “Unable to launch the application”

How to Close Frozen Applications in macOS

How to sign app

How to modify a compiled Android application (.apk file)

If application data needs to be sent to IP address xx.xx.xx.xx, how does it work in underneath netwo

在pycharm中调试ryu应用(How to debug Ryu applications in Pycharm or other IDEs)