gpt4 book ai didi

IOS:通知只显示交叉按钮不显示类别使用 GCM

转载 作者:行者123 更新时间:2023-11-28 08:51:04 26 4
gpt4 key购买 nike

我试图在 IOS 中使用 UIMutableUserNotificationCategory 显示通知,但它只显示默认的十字按钮而不显示其他按钮,然后我在类别中添加。它应该像下面这样显示。 GCM是否可能或不可能。这就是我在应用程序 didfinishlaunching 中添加类别的方式

// Category
let releaseRoomCategory = UIMutableUserNotificationCategory()
releaseRoomCategory.identifier = categoryID

releaseRoomCategory.setActions([yesAction, noAction],
forContext: UIUserNotificationActionContext.Minimal)
releaseRoomCategory.setActions([yesAction, noAction], forContext: .Default)

let settings: UIUserNotificationSettings =
UIUserNotificationSettings(forTypes: [.Alert, .Badge, .Sound], categories: NSSet(object: releaseRoomCategory) as? Set<UIUserNotificationCategory>)
application.registerUserNotificationSettings(settings)
application.registerForRemoteNotifications()

this is how it suppose to show

最佳答案

你好,我自己终于找到了答案,这就是 GCM 的做法

{"to": <reg_token>, "notification": {"body": "Hello from GCM", "click_action": "RELEASEROOM_CATEGORY"}}

click_action 代表类别 :D 谢谢大家 :D

关于IOS:通知只显示交叉按钮不显示类别使用 GCM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34173367/

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