Jack Humphries Jack Humphries - 4 months ago 41
iOS Question

Choose custom sound for local notifications

How do you change the sound that plays for local notifications? I use the code below to play the default sound:

notif.soundName = UILocalNotificationDefaultSoundName;

So, I tried this below, and it didn't work. What should I do? Thanks for your help!

notif.soundName = @"sound.caf";


That should work. Make sure the sound is actually in your app’s bundle, is in the correct format (linear PCM or IMA4—pretty much anywhere that explains how to convert sounds for iOS will tell you how to do that), and is under 30 seconds.