iOS - Sending Push Notification Image to APNs via FCM not working

Viewed 1101

Trying to send an image to APNs using Firebase Cloud Messaging but the payload in Firebase Docs do not work.

Firebase Docs: 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!"
  }
}'
1 Answers

So I ran into the same problem and I added image in the notification field in the payload which fixed it.

Here's an example:

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

Seems like the documentation is pretty wrong.

Related