【发布时间】:2022-01-16 14:18:51
【问题描述】:
我一直在尝试将推送通知中的图像发送到 iOS 设备。我的推送通知可以发送没有任何错误,但图像没有显示。
到目前为止我所做的尝试:
- 按照 FlutterFire 指南允许通知图像创建服务扩展 (
com.companyname.productname.NotificationExtension) - 为
com.companyname.productname.NotificationExtension创建配置文件并将其下载到我的 Mac 上 - 将应用程序和扩展程序的目标设置为 12.3
我可以:
- 在我的 iPhone 上构建应用程序
- 使用 Firebase HTTP 端点或 Firebase 控制台向其发送通知
- 在我的 iPhone 上查看这些通知
我不能:
- 查看每个通知所附的图片
我的 HTTP 请求如下所示:
curl --request POST \
--url https://fcm.googleapis.com/v1/projects/${project_name}/messages:send \
--header 'Authorization: Bearer ${access token}' \
--header 'Content-Type: application/json' \
--data '{
"message":{
"token":"token",
"notification":{
"title":"test notification title",
"body":"test notification body",
"image":"https://image_url"
},
"apns":{
"payload":{
"aps":{
"mutable-content":1
}
},
"fcm_options":{
"image":"https://image_url"
}
},
"data":{
"some_arbitrary_data":"some_arbitrary_data"
}
}
}'
我会在这里遗漏什么?
[更新] 问题似乎是我的通知扩展根本没有被调用。
【问题讨论】:
-
你能在 apple->imageUrl 中看到一个图像值吗?
-
什么是apple->imageUrl?
-
它是 ios 远程消息中的图像字段
标签: ios firebase flutter firebase-cloud-messaging