适用于 iOS 的 APNS 通知声音
我在为我的应用设置消息声音时遇到了一些问题.
I am having some trouble setting the message sound for my app.
所以在服务器发送的 apns 响应中,我指定了 "sound" : "default"
,一切都很好.但是,如果我设置了 "sound":"chime"
或 "sound":"note"
,它们似乎不起作用.它总是播放默认.这些是我从 iPhone 中看到的声音 -> 设置 -> 声音.
So in the apns response sent by the server, I specify "sound" : "default"
, and its all good.
But if I set the "sound":"chime"
, or "sound":"note"
, they dont seem to work. It always plays Default. Those are sounds i see form iPhone -> settings -> Sounds.
我如何使用Note"作为我首选的通知声音,或者我应该创建自己的声音并将其添加到捆绑包中?
How can i use the "Note" as my preferred notification sound, or should i create my own sound, and add it to the bundle?
如果要播放默认声音以外的声音,则需要将声音打包到您的 bundle 中,并在其中指定声音的文件名有效载荷.例如,如果我要在我的应用程序中包含一个名为 notificationCupcake.caf
的声音文件,我会在推送中包含这个 JSON 键/值对:
If you want to play a sound other than the default one, you will need to package the sound in your bundle and specify the file name of the sound in the payload. For example, if I were to include a sound file called notificationCupcake.caf
in my app, I would include this JSON key/value pair in the push:
"sound": "notificationCupcake.caf"