I have a count down timer that “beeps” every second it counts through AVAudioPlayer.
i want to set a user option to keep the app awake through an on/off switch.
i know that in order to keep the app awake you need to set
[UIApplication sharedApplication].idleTimerDisabled = YES;
however how would i control the YES or NO option through a switch? Also, i noticed that after keeping the app awake for more than 5 minutes the audio (a beep sound in my case) is muted? Why is that and how can i avoid it?
I have a count down timer that beeps every second it counts through AVAudioPlayer.
Share
You need a UISwitch. Just connect it to the following method to your .m:
Of course, you need to set the correct value initially:
And just for completion, you have to add the following lines to your .h and connect them in you .nib file: