Возвращает список уведомлений приложения, которые все еще отображаются в Центре уведомлений.
let center = UNUserNotificationCenter.current()
center.getDeliveredNotifications(completionHandler: { (notificationRequests) in
for x in notificationRequests {
print(x.request.content.body)
}
})
Вот ссылка на Apple Doc https://developer.apple.com/documentation/usernotifications/unusernotificationcenter/1649520-getdeliverednotifications
Другой способ
Все эти удаленные push-уведомления, передаваемые вашим внутренним сервером через облачный сервер Apple .Лучше вы запросите на своем сервере получить все полезные данные push-уведомлений в ответ и отобразить их клиенту. Здесь вы управляете в соответствии с вашими потребностями.
А затем вы удаляете уведомления из панели уведомлений .. вот так.
application.applicationIconBadgeNumber = 0 // For Clear Badge Counts
let center = UNUserNotificationCenter.current()
center.removeAllDeliveredNotifications() // To remove all delivered notifications
center.removeAllPendingNotificationRequests()