我正在使用FCM从服务器将推送通知发送到iOS设备,但是我成功获取了通知,但是无法播放自定义通知声音。
这是我的有效载荷
{
"to":"myToken",
"notification":{
"title":"new message",
"body":"Hello World!",
"sound":"tweet_sent.caf",
"badge": 3
}
}
注意:我也将'tweet_sent.caf'文件添加到了Xcode包
答案 0 :(得分:0)
**Please replace "notification" key with "aps" like**
{
"to":"myToken",
"aps":{
"title":"new message",
"body":"Hello World!",
"sound":"tweet_sent.caf",
"badge": 3
}
}
And also add sound **"tweet_sent.caf"** file into your project resource location.
答案 1 :(得分:0)
感谢您的回答和评论
在构建阶段(Xcode)中添加通知文件后,现在工作正常。
对于参考:Playing a custom sound on receiving a remote push notification on iOS 12 from FCM