11
votes

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?

The code is like this

{
    "aps": {
        "badge": 10,
        "alert": "Hello",
        "sound": "sound.mp3"
    }
}

Nithin

2
could you add a little bit of code to this question to show how you set the custom sound for your push notifications?Michael Dautermann

2 Answers

28
votes

According to the push notification guide:

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.

It doesn't say anything about MP3s. I've used aif files which worked. I'd stick to what Apple specifies.

5
votes

You can't play .mp3-files. However, you can convert them into .wav files here: http://media.io/ (online & free). Then put the converted file in your XCode project and you can call it by specifying "sound":"sound.wav"