简体   繁体   中英

iOS Local Notification Sound Not Working

I'm using a UILocalNotification to inform a user about some events. The problem is, if I choose a custom sound for that, the system's default sound is played nonetheless. The weird thing about that is that sometimes it still works with my sound and sometimes it doesn't. I have properly adressed the file and converted it into a correct caf format. When I reboot the device it works perfectly. So why does my sound play some times and other times the system default Sound?

your notification sounds may not be longer than 30 seconds - if the file supplied is longer, nothing will sound.

Also,check the sound in some external player first, and best convert it to .caf format.

To convert a file to .caf, open up terminal, go to where you have your sound stored and type in:

afconvert -f caff -d LEI16@44100 -c 1 yourfile.wav yourfile.caf Then just set it like:

yourNotification.soundName = @"yoursound_name.caf";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM