Stephen Fox
Stephen Fox

Reputation: 14470

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)

Upvotes: 5

Views: 1508

Answers (1)

B.S.
B.S.

Reputation: 21726

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

Upvotes: 20

Related Questions