Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!"
  }
}'
like image 640
Tal Zion Avatar asked Oct 15 '25 08:10

Tal Zion


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.

like image 171
Raymond Qiu Avatar answered Oct 16 '25 22:10

Raymond Qiu