Firebase 不显示丰富的推送通知

Firebase not displaying rich push notification

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

我已经创建了用于处理内容的通知服务扩展,但它从未被调用。

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

Json 负载(不工作):

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

   }

}

仅供参考: 如果我在有效负载中添加 "notification" 键值,我就能收到推送。

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"
   }

}     

对此有什么想法吗??

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

想知道我怎么会犯这么愚蠢的错误..!! :D