[英]Error in console using UIAlertAction Xcode 7.3 beta
我正在尝试使用Alertview将错误打印给用户。 这是我的代码:::
if error != nil{
let DisplayAlert = UIAlertController(title: "Error!!", message: error?.description, preferredStyle: .Alert)
DisplayAlert.addAction(UIAlertAction(title: "OK", style: .Default, handler: nil))
}
运行代码时,我在控制台中看到以下内容,并且看不到向用户显示任何警报。
“不允许在取消分配时尝试加载视图控制器的视图,这可能导致未定义的行为”
我该怎么做才能解决此问题。 请帮助。 谢谢 !!!
好像您忘记了发出警报
if error != nil{
let DisplayAlert = UIAlertController(title: "Error!!", message: error?.description, preferredStyle: .Alert)
DisplayAlert.addAction(UIAlertAction(title: "OK", style: .Default, handler: nil))
self.presentViewController(DisplayAlert, animated: true, completion: nil)
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.