1

我正在使用可操作的通知。以下来自后端的数据:

  1. 通知 ID(字符串)
  2. 通知标题、正文
  3. 两个动态标题显示操作按钮

我正在注册针对 notificationId 的操作,如下所示:

  let notificationCategory = UNNotificationCategory (
        identifier : notificationId,
        actions : [actionPositive, actionNegative],
        intentIdentifiers : [],
        options : []
    )
    UNUserNotificationCenter.current ()
    .setNotificationCategories ([notificationCategory])

如何处理多个notificationCategories,因为setNotificationCategories()取消注册所有现有类别以注册新类别(即被新类别覆盖)。

我在显示具有不同动态操作的通知时遇到了问题。我发现没有一个博客/代码可以做到这一点。

4

0 回答 0