I\'m using UILocalNotification
in an application.
In the application there are two sounds which are played conditionally- I have applied proper conditio
Did you try to turn off "Do not disturb" mode off? I have the same problem, then I found out "Do not Disturb" is on. After turn off that, it all works the right way.
If mp3 file is edited with some tool, it is possible that something was missed by edit tool.
I had similar problem while trying to play mp3 file as local notification sound. Sound was shorter than 30 seconds, it was bundled, everything appears regular on the surface. After few hours i have realised that problem was caused by online mp3 cutter tool. I have find better editor, and file became playable on notification.
Make sure the sound is added to the main bundle!
try using .caf
file instead of .mp3
afconvert -f caff -d LEI16@44100 -c 1 wolf.wav wolf_out.caf
I didn't get any idea why it did work.
But, at last I have solved my problem by making a new project in Xcode 5.0 and ported old project to this new project. So it's working and I can get sound too.
I ran into the same issue, I had to do the following steps:
Convert the file from mp3 or wav to caf. As stated in other answers you can convert wav, aif and mp3 files in terminal using the command:
afconvert -f caff -d LEI16@44100 -c 1 in.mp3 out.caf
You can also export with Quicktime 7 as .aif with the following settings Linear PCM Rate 44.100 Linear PCM sample size 16 these aif files seem to be supported.
Make sure you files are less than 30 seconds, i.e 29 seconds or less.
Add you files to the root of your bundle, you can drag drop into Xcode or right click "add files to (projectname)"
Note you must select the following options:
a)Destination Copy items if needed
b)Add to targets (your build name(s))
4)Reference the file by its name including the extension e.g
notif.soundName = @"sound.caf";
Make sure you delete the app from the device / simulator between tests or you will not see the results of your changes.
If your still having problems, check the sound file file is in the root of the project. Check the Sound file "Target Membership" is selected in the show file inspector.