简体   繁体   中英

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 remove notification from notification center

iOS application: how to clear notifications?

iOS application: how to clear notifications?

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,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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