使用HTTP v1 API
向iOS设备发送APN时,Apple documentation表示如果apns-priority
设置为10
,则
Notifications with this priority must trigger an alert, sound, or badge on the target device
documentation at Firebase似乎建议添加到apns JSON对象:
我只在使用JSON POST中的以下内容设置优先级 时才成功:
"apns": {
"headers": {
"apns-priority": "10"
}
},
当我按照文档建议发布以下内容时:
...
"apns": {
"headers": {
"apns-priority": "10"
},
"payload": {
"sound": "default"
}
},
...
400 - Bad Request
从FCM服务器返回。如果我排除payload
json部分,则POST工作。
还尝试了以下内容:
...
"apns": {
"headers": {
"apns-priority": "10"
},
"sound": "default"
...
仍然收到400 - 错误请求
如何在SDK API JSON POST中的APN上设置声音?默认声音就足够了。
答案 0 :(得分:1)
声音对象必须是aps
对象的一部分:
...
"apns": {
"headers": {
"apns-priority": "10"
},
"payload": {
"aps": {
"sound": "default"
}
}
},
...
答案 1 :(得分:0)
根据您的JSON,您似乎正在使用HTTP v1 API。
“apns”特定字典描述为here。
例如,为了播放默认声音:
...
"apns": {
"headers": {
"apns-priority":"10"
},
"payload": {
"sound":"default"
},
},
...