gpt4 book ai didi

ios - 如何将相同的 UNNotificationContentExtension 与不同的 UNNotificationAction 一起使用?

转载 作者:行者123 更新时间:2023-12-03 17:09:31 27 4
gpt4 key购买 nike

我想创建 UNNotificationContentExtension 来显示一些自定义 UI。为此,我必须为 UNNotificationContentExtension 创建一些类别,并在安排通知时将其用作类别标识符。我还想通过这个丰富的通知添加一些操作,我已经用

完成了这些操作
let category = UNNotificationCategory(identifier: notificationContentCategory, actions: [firstAction, secondAction, thirdAction, fourthAction], intentIdentifiers: [], options: [])
UNUserNotificationCenter.current().setNotificationCategories([category])

现在,根据新的应用程序要求,这些丰富的通知应该针对不同的条件有一组不同的操作。据我所知,没有办法将不同一组操作关联到相同 UNNotificationContentExtension。有没有办法将不同一组操作关联到相同 UNNotificationContentExtension ?

我仅处理本地通知。

最佳答案

找到了解决方案。我们可以在通知内容扩展的 info.plist 的 UNNotificationExtensionCategory 属性中添加标识符数组。在此添加所有标识符。

关于ios - 如何将相同的 UNNotificationContentExtension 与不同的 UNNotificationAction 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45430104/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com