Когда приложение находится на переднем плане, когда нажаты 2 или более уведомлений. Мы должны отобразить только одно предупреждение, а остальные должны быть в центре уведомлений, но не должны быть предупреждены как баннер в iOS 11. Возможно ли это?
Я пробовал приведенный ниже фрагмент кода.
public func userNotificationCenter(_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
center.getDeliveredNotifications { (notifications) in
print("number of notifications delivered so far : \(notifications.count)")
if notifications.count > 0 {
print(notification.request.content.userInfo["aps"] as Any)
// TODO: add to core data
}
else {
completionHandler(UNNotificationPresentationOptions.alert)
}
}
// Presentation type
//completionHandler(UNNotificationPresentationOptions.alert)
}
, но уведомление не появляется в центре уведомлений.
как узнать, отображается ли уведомление в iOS 11.0?