Search code examples
iospush-notificationapple-push-notifications

Custom iOS push notification sound


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


Solution

  • 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.