I get a warning that appears when the user runs out of time. It just vibrates right now, but I also want it to play an audio signal. Is there a way to play no matter what the user sets as the default alarm for the system? In addition, is it possible for the alarm to continue until the user clicks the Cancel button?
Here is my code:
func dismissAlert(alert:UIAlertAction!)
{
self.dismissViewControllerAnimated(true, completion: nil)
}
let outOfTimeAlert = UIAlertController(title: "Out Of Time", message: "Better luck next time", preferredStyle: UIAlertControllerStyle.Alert)
let cancelAlert: UIAlertAction = UIAlertAction(title: "Dismiss", style: .Cancel, handler: dismissAlert)
outOfTimeAlert.addAction(cancelAlert)
presentViewController(outOfTimeAlert, animated: true, completion: nil)
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate)
Thanks for the help!
source
share