FCM UNNotificationServiceExtension无法正常工作

时间:2018-02-16 10:51:43

标签: ios push-notification firebase-cloud-messaging swift4

我为 UNNotificationServiceExtension 创建了一个用于编辑通知标题的目标。

现在,如果我使用 Pusher 使用 APNS ,我的通知标题会发生变化并且正常运行。

{"aps":{"alert":"push Notification","badge":1,"sound":"default","mutable-content":1}}

这是我通过APNS发送的内容。

但是我找不到FCM的解决方案U应该发送什么数据以及它将如何工作

override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
    self.contentHandler = contentHandler
    bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
}

1 个答案:

答案 0 :(得分:0)

我也遇到了同样的问题,修改有效负载对我有帮助。

{"aps":{"alert":"push Notification","badge":1,"sound":"default","mutable_content":true}}

有关更多详细信息,请遍历此link