【发布时间】:2018-11-06 09:03:34
【问题描述】:
该应用同时在 iOS 和 Android 上运行,为了让此通知在两个平台上都能正常工作,我从通知 json 有效负载中删除了 notification 字段。但是现在 iOS 在后台不处理这个通知。
这个适用于 iOS,但它有 notification 字段,我确实不想要。
{
"registration_ids": [
"...",
"..."
],
"priority": "high",
"notification": {
"body": "Notification Body.",
"title": "Notification Title"
},
"data": {
"userId": "11111",
"badge": 10
}
}
这个可以在 android 中运行,但不在后台运行在 iOS 上:
{
"registration_ids": [
"...",
"..."
],
"mutable_content": true,
"content_available": true,
"data": {
"click_action": "AndroidIntent"
"message": "Notification Body",
"myDataField": "11",
"location": "3",
"imageurl": "http://image.com/13fd.png"
}
}
底部的甚至没有进入我的通知服务扩展。如何确保调用通知服务扩展而不在我的 json 中添加 notification 字段?
【问题讨论】:
-
上面的payload中带有“notification”键的是否进入了Notification Service Extension?我也有同样的问题。我的通知服务没有被调用,这就是我无法通过 FCM 在通知上创建缩略图的原因。
标签: ios swift firebase apple-push-notifications firebase-cloud-messaging