Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIAlertController EXC_BAD_ACCESS error - Swift

I am trying to use a UIAlertController in Swift, with iOS 7, and I keep getting the following error when the alert should appear: EXC_BAD_ACCESS (code = 1, address = 0x10)

Here is the code for the alert.

var alert:UIAlertController = UIAlertController(title: "Ooops", message: "Please Fill In Everything", preferredStyle: UIAlertControllerStyle.Alert)
        alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
        self.presentViewController(alert, animated: true, completion: nil)
like image 986
Stephen Fox Avatar asked Jun 11 '14 14:06

Stephen Fox


1 Answers

UIAlertController is available only since iOS 8.0. You should still use UIAlertView instead

like image 81
B.S. Avatar answered Nov 07 '22 12:11

B.S.