APNS notification sound for iOS

南笙酒味 提交于 2019-12-19 02:39:29

问题


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

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.

How can i use the "Note" as my preferred notification sound, or should i create my own sound, and add it to the bundle?


回答1:


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"


来源:https://stackoverflow.com/questions/25478395/apns-notification-sound-for-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!