Firebase云消息-如何向APN添加声音

Firebase云消息-如何向APN添加声音,firebase,audio,apple-push-notifications,firebase-cloud-messaging,Firebase,Audio,Apple Push Notifications,Firebase Cloud Messaging,使用HTTP v1 API向iOS设备发送APN时,状态为如果apns priority设置为10,则 Notifications with this priority must trigger an alert, sound, or badge on the target device 似乎建议添加到apns JSON对象: 我只在JSON POST中设置优先级only时成功: "apns": { "headers": { "apns-

使用
HTTP v1 API
向iOS设备发送APN时,状态为如果
apns priority
设置为
10
,则

Notifications with this priority must trigger an alert, sound, or badge on the target device
似乎建议添加到apns JSON对象:

我只在JSON POST中设置优先级only时成功:

"apns": {
            "headers": {
                "apns-priority": "10"
            }
        },
当我按照文档建议发布以下内容时:

...
"apns": {
            "headers": {
                "apns-priority": "10"
            },
            "payload": {
                "sound": "default"
            }
        },
...
400-错误请求
从FCM服务器返回。如果我排除了
payload
json部分,则POST可以工作

还尝试了以下方法:

...
"apns": {
            "headers": {
                "apns-priority": "10"
            },
            "sound": "default"
...
仍然收到400个错误的请求

如何在SDK API JSON POST中的APN上设置声音?默认的声音就足够了


根据您的JSON,您似乎正在使用HTTP v1 API

描述了特定于“apns”的词典

例如,要播放默认声音:

...
"apns": {
  "headers": {
    "apns-priority":"10"
  },
  "payload": {
    "sound":"default"
  },
},
...

声音对象需要是
aps
对象的一部分:

...
"apns": {
   "headers": {
       "apns-priority": "10"
    },
    "payload": {
        "aps": {
            "sound": "default"
        }
    }
 },
...

谢谢你的链接,但请看我的文章编辑关于你的建议。