Firebase未显示丰富的推送通知

时间:2017-11-15 13:42:25

标签: ios swift push-notification firebase-cloud-messaging rich-media

我在我的应用程序中使用firebase通知。我想发送丰富的通知,但firebase控制台没有相同的UI。所以我试图用邮递员发送有效载荷。

我已经创建了Notification Service Extension来处理内容,但它永远不会被调用。

xCode中的部署目标是 iOS 10.0 ,iPad有 iOS 11

Json有效负载(不工作):

  {
    "to":"/topics/dev_news",
   "mutable_content": true,
   "data":
   {
        "attachment-url":"my image url",
        "media_type":"image"

   }

}

供参考: 如果我在有效负载中添加“通知”键值,我就能收到推送。

Json有效载荷(工作但没有媒体):

{
    "to":"/topics/dev_news",
   "mutable_content": true,
   "data":
   {
        "attachment-url":"my image url",
        "media_type":"image"

   },
   "notification" : {
    "title" : "demo push",
    "body" : "this is push body"
   }

}     

对此有任何想法??

1 个答案:

答案 0 :(得分:1)

回答我自己的问题,我在服务扩展类中的attachment-url字典(我在有效负载中传递)中搜索data。但是attachment-url直接来自content.userInfo(它没有包含在data字典中)扩展类中。

想知道我怎么能犯这么傻的错误.. !! :D