自定义 iOS 推送通知声音 [英] Custom iOS push notification sound
问题描述
我遇到了一个问题.我在 iOS 中使用自定义声音实现了推送通知.它是一个 MP3 文件.当我在 iOS 5 中收到推送通知时,它播放得很好,但在 iOS4 中,它不播放任何声音.你能帮我解决这个问题吗?
I have been facing an issue. I implemented push notification in iOS with custom sound. Its a MP3 file. It plays well when I receive a push notification in iOS 5, but in iOS4, it doesn't play any sound. Can you help me with this?
代码是这样的
{
"aps": {
"badge": 10,
"alert": "Hello",
"sound": "sound.mp3"
}
}
Nithin
推荐答案
根据推送通知指南:
您可以将音频数据打包到 aiff、wav 或 caf 文件中.然后,在Xcode,将声音文件作为非本地化资源添加到您的项目中应用程序包.
You can package the audio data in an aiff, wav, or caf file. Then, in Xcode, add the sound file to your project as a nonlocalized resource of the application bundle.
它没有提及 MP3.我使用了有效的 aif 文件.我会坚持 Apple 指定的内容.
It doesn't say anything about MP3s. I've used aif files which worked. I'd stick to what Apple specifies.
这篇关于自定义 iOS 推送通知声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!