在iOS 2小时后,有什么方法可以自动删除/删除推送通知?

时间:2019-05-27 06:55:33

标签: ios swift push-notification apple-push-notifications

我尝试了多种方法从应用程序和服务器上执行此操作,但未成功。

1 个答案:

答案 0 :(得分:0)

管理已发送的通知

  

当本地和远程通知未由您的应用程序或用户直接处理时,它们会显示在通知中心中,以便以后查看。使用共享的UNUserNotificationCenter对象的getDeliveredNotificationsWithCompletionHandler:方法来获取仍在通知中心显示的通知列表。如果发现现在已经过时且不应显示给用户的任何通知,则可以使用removeDeliveredNotificationsWithIdentifiers:方法将其删除。

https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/SupportingNotificationsinYourApp.html#//apple_ref/doc/uid/TP40008194-CH4-SW1

发送无声推送通知,您必须从通知中心获取应用程序的所有通知,然后根据需要将其删除。