我试图在同一个窗口中收到两个弹出警报,
但是使用第二个警报功能,程序会运行但是当点击按钮时会崩溃并显示错误
错误:libc ++ abi.dylib:以NSException类型的未捕获异常终止
@IBAction func buttonPressed(sender: UIButton) {
let title = "Display Title"
let message = "You just clicked on Display Alert"
let okText = "OK"
let title1 = "Display Title"
let message1 = "You just clicked on Display Alert"
let okText1 = "OK"
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.Alert)
let okayButton = UIAlertAction(title: okText, style: UIAlertActionStyle.Cancel, handler: nil)
alert.addAction(okayButton)
let alert1 = UIAlertController(title: "title1", message: "message1", preferredStyle: UIAlertControllerStyle.Alert)
let okayButton1 = UIAlertAction(title: okText1, style: UIAlertActionStyle.Cancel, handler: nil)
alert.addAction(okayButton1)
presentViewController(alert, animated: true, completion: nil)
presentViewController(alert1, animated: true, completion: nil)
}