IOS 应用程序中未收到 Firebase 推送通知徽章计数

Tul*_*Das 2 push-notification node.js ios firebase firebase-cloud-messaging

我正在从 nodejs 服务器使用 firebase 发送推送通知。

消息有效负载是这样的。

const notificationObjNew: any = {
        notification: {
            body: "demo body",
            title: "demo title",
            badge : "100",
        },
        topic: notificationTopic
    };
Run Code Online (Sandbox Code Playgroud)

在 IOS 应用程序中,我收到了这个-

{body:demo body,e:1,title:demo title}
Run Code Online (Sandbox Code Playgroud)

这里没有徽章属性。

小智 5

IOS 在密钥下接收徽章计数apsaps您可能也共享了下面的警报本身的 JSON 。

正常有效负载

"aps" : {
      "alert" : {
         "title" : "Game Request",
         "subtitle" : "Five Card Draw",
         "body" : "Bob wants to play poker",
      }
   }
Run Code Online (Sandbox Code Playgroud)

badge

"aps" : {
      "alert" : {
         "title" : "Game Request",
         "subtitle" : "Five Card Draw",
         "body" : "Bob wants to play poker",
      },
      "badge":9
   }
Run Code Online (Sandbox Code Playgroud)