【发布时间】:2016-06-29 11:11:27
【问题描述】:
当用户在 alertView 中按下 Go home 时,我尝试返回视图控制器,它向我显示错误(libc++abi.dylib: terminating with uncaught exception of type NSException)
@IBAction func roundButton(sender: AnyObject) {
//add alert
alertController = UIAlertController(title: "Return Home", message: "Are you sure???", preferredStyle: .Alert)
let alertAction1 = UIAlertAction(title: "Cancel", style: .Default) { (action) in
}
let alertAction2 = UIAlertAction(title: "Go Home", style: .Destructive) { (action) in
let nv = self.storyboard!.instantiateViewControllerWithIdentifier("storyboardidentifier") as! ViewController
self.presentViewController(nv, animated:true, completion:nil)
}
alertController?.addAction(alertAction2)
alertController?.addAction(alertAction1)
self.presentViewController(alertController!, animated: true, completion: nil)
//end alert
}
【问题讨论】:
-
你能告诉我异常信息吗?通常有一条消息后跟异常,就在堆栈跟踪之前。
标签: swift