适用于iOS的APNS通知声音

问题描述:

我在设置应用的消息声时遇到了一些问题。

I am having some trouble setting the message sound for my app.

所以在服务器发送的apns响应中,我指定sound:default,及其都好。
但如果我设置声音:chime,或声音:注意,他们似乎没有工作。它总是播放默认值。这些是我从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?

如果您想播放默认声音以外的其他声音,则需要将声音打包在捆绑包中,并指定有效负载中声音的文件名。例如,如果我在我的应用程序中包含一个名为 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"