适用于iOS的APNS通知声音 [英] APNS notification sound for iOS

查看:486
本文介绍了适用于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"

这篇关于适用于iOS的APNS通知声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆