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

IOS:通知仅显示交叉按钮,不使用GCM显示类别,ios,swift,push-notification,google-cloud-messaging,Ios,Swift,Push Notification,Google Cloud Messaging,我试图在IOS中显示UIMutableUserNotificationCategory通知,但它只显示默认的交叉按钮,不显示其他按钮,然后我添加到Category中。应该是这样的。GCM是否可行。这就是我在应用程序didfinishlaunching中添加类别的方式 // Category let releaseRoomCategory = UIMutableUserNotificationCategory() releaseRoomCategory.identifier = categoryI

我试图在IOS中显示UIMutableUserNotificationCategory通知,但它只显示默认的交叉按钮,不显示其他按钮,然后我添加到Category中。应该是这样的。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()
//类别
让releaseRoomCategory=UIMutableUserNotificationCategory()
releaseRoomCategory.identifier=类别ID
releaseRoomCategory.setActions([yesAction,noAction],
forContext:UIUserNotificationActionContext.Minimal)
releaseRoomCategory.setActions([yesAction,noAction],forContext:.默认值)
let设置:UIUserNotificationSettings=
UIUserNotificationSettings(类型:[.Alert、.Badge、.Sound],类别:NSSet(对象:releaseRoomCategory)as?Set)
application.registerUserNotificationSettings(设置)
应用程序.注册表项更改()

嗨,我终于找到了答案,这就是GCM的工作方式

{"to": <reg_token>, "notification": {"body": "Hello from GCM", "click_action": "RELEASEROOM_CATEGORY"}}
{“收件人”:,“通知”:{“正文”:“GCM你好”,“点击操作”:“发布室类别”}

点击行动是代表类别:D谢谢每一个人:D

Hi终于找到了答案我自己这是如何为GCM完成的

{"to": <reg_token>, "notification": {"body": "Hello from GCM", "click_action": "RELEASEROOM_CATEGORY"}}
{“收件人”:,“通知”:{“正文”:“GCM你好”,“点击操作”:“发布室类别”}

点击操作代表类别:D谢谢每一个:D

gcm应该用于android消息,你应该使用apns苹果推送通知服务IOS服务器正在使用gcm用于IOS和android我不确定我可以在IOS的gcm有效负载中设置类别你还需要ApplePushNotification服务,你需要一个证书是的,我做了所有这些,也收到了通知,但现在我找不到我如何通过gcm通知中的类别,如{“aps”:{“badge”:1,“alert”:“Hello world!”,“category”:“SHARE_category”}根据GCM在这里发送下游消息的官方文档:您可以尝试在
数据中发送分类,稍后在您的应用程序中处理。GCM应该用于android消息,你应该使用apns苹果推送通知服务IOS服务器在IOS和android上都使用gcm我不确定我可以在IOS的gcm有效负载中设置类别你还需要ApplePushNotification服务,你需要一个证书是的,我做了所有这些,也收到了通知,但现在我找不到我如何通过gcm通知中的类别,如{“aps”:{“badge”:1,“alert”:“Hello world!”,“category”:“SHARE_category”}根据GCM发送下游消息的官方文档:您可以尝试在
数据中发送分类,稍后在您的应用程序中处理。