我正在尝试使用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()
答案 0 :(得分:0)
嗨,终于找到了我自己的答案,这就是它为GCM所做的工作
{"to": <reg_token>, "notification": {"body": "Hello from GCM", "click_action": "RELEASEROOM_CATEGORY"}}
click_action代表类别:D感谢每一个:D