【问题标题】:iOS - Sending Push Notification Image to APNs via FCM not workingiOS - 通过 FCM 向 APN 发送推送通知图像不起作用
【发布时间】:2021-05-04 20:10:42
【问题描述】:

尝试使用 Firebase 云消息传递将图像发送到 APN,但 Firebase 文档中的负载不起作用。

Firebase 文档:https://firebase.google.com/docs/cloud-messaging/ios/send-image

## Request
curl -X "POST" "https://fcm.googleapis.com/fcm/send" \
     -H 'Content-Type: application/json' \
     -H 'Authorization: key={web_token}' \
     -d $'{
  "to": "fcm_token",
  "priority": "high",
  "apns": {
    "payload": {
      "aps": {
        "mutable-content": 1
      }
    },
    "fcm_options": {
      "image": "mage_urli"
    }
  },
  "data": {
    "Room": "PortugalVSDenmark",
    "Nick": "Mario"
  },
  "notification": {
    "title": "Portugal vs. Denmark",
    "body": "great match!"
  }
}'

【问题讨论】:

标签: ios push-notification firebase-cloud-messaging apple-push-notifications


【解决方案1】:

所以我遇到了同样的问题,我在修复它的有效负载的通知字段中添加了图像。

这是一个例子:

"notification": {
  "title": "Portugal vs. Denmark",
  "body": "great match!",
  "image": "image-url"}

似乎文档是非常错误的。

【讨论】:

  • 你应该得到一个奖项..好哥们 ;-) 谢谢。它对我有用!!!
猜你喜欢
  • 1970-01-01
  • 2019-08-07
  • 1970-01-01
  • 2018-03-05
  • 2018-04-24
  • 2020-10-14
  • 1970-01-01
  • 1970-01-01
  • 2022-09-28
相关资源
最近更新 更多