【发布时间】: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!"
}
}'
【问题讨论】:
-
我也在努力让它工作并遇到麻烦。首先,我认为标头需要与 fcm_options 处于同一级别,并且不应位于有效负载内。 firebase.google.com/docs/reference/fcm/rest/v1/… 其次,您是否为启用 UserNotificationsUI / UNNotificationContentExtension 做了任何额外的事情? stackoverflow.com/questions/37839171/…developer.apple.com/documentation/usernotifications/…
标签: ios push-notification firebase-cloud-messaging apple-push-notifications