简体   繁体   English

iOS示例代码可从通知中心清除我的应用程序通知?

[英]iOS Sample Code to clear my application notification from Notification Center?

I have been looking for a way to write a method that I can call on a button inside my application to remove all notifications that was received from server side , and delete all notifications from the notification center iOS , I have tried all the suggested solutions , : 我一直在寻找一种写方法的方法,我可以在应用程序内的按钮上调用该方法,以删除从服务器端收到的所有通知,并从iOS通知中心删除所有通知,我尝试了所有建议的解决方案, :

iOS remove notification from notification center iOS从通知中心删除通知

iOS application: how to clear notifications? iOS应用程序:如何清除通知?

iOS application: how to clear notifications? iOS应用程序:如何清除通知?

is there any way that I could get handle for the notification inside the notification center and do clear or delete 有什么办法可以让我在通知中心内处理通知并进行清除或删除

Regards, 问候,

thanks all , 谢谢大家,

I have solved my problem after trying so many codes , I called a method on a button and it worked with this snippet: 在尝试了许多代码之后,我已经解决了我的问题,我在按钮上调用了一个方法,并且可以使用以下代码段:

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

Regards, 问候,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM