UIAlertController在关闭WiFi时出错
let networkIssueController = UIAlertController(title: "Error",
message: "Unable to load data. Connectivity error!",
preferredStyle: .Alert)
let okButton = UIAlertAction(title: "Ok", style: .Default, handler: nil)
networkIssueController.addAction(okButton)
let cancelButton = UIAlertAction(title: "Cancel", style: .Cancel, handler: nil)
networkIssueController.addAction(cancelButton)
self.presentViewController(networkIssueController, animated: true, completion: nil)
错误显示为EXC_BAD_ACCESS(code=1,address=0x10)
导致此错误的原因是什么?
答案 0 :(得分:1)
尝试添加单独的alertView实例。
答案 1 :(得分:0)
这是一个简单的警报视图,这非常有效。试试这个。
let alertController = UIAlertController(title: "Warning", message: "Test", preferredStyle: UIAlertControllerStyle.Alert)
let cancel = UIAlertAction(title: "OK", style: UIAlertActionStyle.Cancel, handler: nil)
alertController.addAction(cancel)
self.presentViewController(alertController, animated: true, completion: nil)