【问题标题】:Remove a particular push notification from notification center tray从通知中心托盘中删除特定的推送通知
【发布时间】:2018-11-21 09:01:40
【问题描述】:

我需要从通知中心删除特定通知。 在我的应用中,我正在使用这种方法打开一个特定类型的通知

let center = UNUserNotificationCenter.current()
center.getDeliveredNotifications(completionHandler: { (notificationRequests) in
        for x in notificationRequests {
        print(x.request.content.userInfo)
    }
    })

所以我想在阅读后删除该通知。

【问题讨论】:

    标签: ios swift firebase push-notification


    【解决方案1】:

    每个通知都有一个标识符,在阅读通知后您可以简单地做 -

    UNUserNotificationCenter.current().removeDeliveredNotifications(withIdentifiers: [notification_identifier_here])
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-28
      相关资源
      最近更新 更多