Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIAlertView in Swift, getting EXC_BAD_ACCESS

Tags:

First and foremost, I'm quite aware that Xcode 6 and the Swift language are in Beta and are prone to errors; however, this particular one seems to be something strange as everything else I've tried so far seems to work fine.

If this is not appropriate for StackOverflow, I will gladly remove the question.

I've begin playing with Xcode 6/Swift (preparing for its release) and it has been an extraordinarily enjoyable experience compared to what I thought it would be. That being said, one issue in porting a "training" style app I like to do is that I can't seem to generated a UIAlertView due to EXC_BAD_ACCESS the code in question is:

override func viewDidAppear(animated: Bool) {
    super.viewDidAppear(animated)

    var alert = UIAlertView(title: "Title", message: "Message", delegate: nil, cancelButtonTitle: "OK") // EXC_BAD_ACCESS here
    alert.show()
}

On the line that creates the UIAlertView I get an EXC_BAD_ACCESS because [UIAlertView retain] was called on a deallocated instance.

Again, I'm chalking this up to the beta banner but was curious if I was doing something wrong or if anyone else has run into similar issues.