FCM rich push notification payload for iOS(适用于 iOS 的 FCM 丰富推送通知负载)
问题描述
我正在为我的项目使用 FCM.它具有丰富的类型推送通知.我尝试修改大多数可能的方式来从 FCM 获取推送.我得到了来自 FCM 的普通推送,而不是图片.
I am using FCM for my project. It's have rich push notification for a type. I tried to modified most of possible ways to get push from FCM. I got obly ordinary push from FCM, not with image.
我还使用 push try 来检查 APNS 相同的编码.我得到了推送通知的预期设计.
I am also check with APNS same coding using push try. I got what expected design for push notification.
这是我的 APNS 有效负载
{
"aps": {
"alert": "Enter your message",
"badge": 1,
"sound": "default",
"content-available": 1,
"mutable-content": 1
},
"mediaUrl": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2a/FloorGoban.JPG/1024px-FloorGoban.JPG"
}
这里FCM有效载荷
{
"to": "dWB537Nz1GA:APA91bHIjJ5....",
"data":
{
"message": "Offer!",
"mediaUrl": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2a/FloorGoban.JPG/1024px-FloorGoban.JPG"
},
"notification":
{
"body": "Enter your message",
"sound": "default",
"content-available": 1,
"mutable-content": 1
}
}
我还需要类别 更多详情FCM中的有效载荷
我是否遗漏了 fire-base 控制台中的任何设置,或者是来自有效负载的设置.
Am I missing any setting in fire-base console or is that from payload.
推荐答案
您的 FCM 负载中的 mutable-content 和 content-available 不正确.它应该被格式化为 mutable_content 和 content_available.两者都是 boolean 并且还必须在 notification 参数之外.像这样:
The mutable-content and content-available in your FCM payload is incorrect. It should be formatted as mutable_content and content_available. Both are boolean and must also be outside the notification parameter. Like so:
{
"to": "dWB537Nz1GA:APA91bHIjJ5....",
"content_available": true,
"mutable_content": true,
"data":
{
"message": "Offer!",
"mediaUrl": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2a/FloorGoban.JPG/1024px-FloorGoban.JPG"
},
"notification":
{
"body": "Enter your message",
"sound": "default"
}
}
对于 FCM 中 category 的对应项,您应该使用 click_action:
For the counterpart of category in FCM, you should use click_action:
与用户点击通知相关的操作.
The action associated with a user click on the notification.
对应于 APNs 负载中的 category.
Corresponds to category in the APNs payload.
这篇关于适用于 iOS 的 FCM 丰富推送通知负载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:适用于 iOS 的 FCM 丰富推送通知负载
- 网上有没有好的 UIScrollView 教程? 2022-01-01
- SetOnItemSelectedListener上的微调程序错误 2022-01-01
- 使用自动布局向 UIScrollView 添加动态大小的视图 2022-01-01
- Xcode 7.3 中带有 UILabel 的 UIStackView 2022-01-01
- GPS状态的广播接收器? 2022-01-01
- 类似于 Mail.app 的 iPad 模态视图控制器? 2022-01-01
- UITextView 内容插图 2022-01-01
- 如何在 iPhone 模拟器中重置 NSUserDefaults 数据? 2022-01-01
- URL编码Swift iOS 2022-01-01
- 在 Iphone SDK 的导航栏上添加多个按钮 2022-01-01
