Tutorial :UILocalNotification Or EventKIt



Question:

Is there a way to trigger some kind of task on the base of date event .My problem is that i want to play sound (alarm) on specific date it does work fine by using UILocalNotification, but it plays s short sound , and i want to play an infinite sound instead of .How can i achieve this goal .. waiting for your early response. Thanks


Solution:1

The apple documentation of UILocalNotification states that the soundName property will play for a maximum of 30 seconds only.

Sounds that lasts longer than 30 seconds are ignored and the default sound is played instead.

While adding the custom sound make sure the sound is in the correct format (linear PCM or IMA4)

You can convert from wav and mp3 using:

afconvert -f caff -d LEI16@44100 -c 1 in.wav out.caf

In case if u were wondering what is afcomvert ..it's nothing but command line program Caf is container format..

Sometimes emulator won't play the custom sound but device does.


Solution:2

You can schedule a custom sound using the soundName property of UILocalNotification, but it can't be infinite. You could use the repeatInterval property to play the alert again, making it seem infinite...


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »