【发布时间】:2018-06-08 22:27:44
【问题描述】:
我正在创建一个警报,但当用户按下“确定”时我无法将其关闭。我收到以下错误:
2017-12-28 07:03:50.301947-0400 Prestamo[691:215874] API 错误: <_uikbcompatinputview:> 返回 0 宽度,假设 UIViewNoIntrinsicMetric
我在 Internet 上到处搜索,但找不到任何对我有帮助的东西。
override func viewDidAppear(_ animated: Bool) {
createAlert(title: "Licencia2", message: "En el momento no tienes una licencia válida!")
}
func createAlert (title:String, message:String) {
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: {(action) in
alert.dismiss(animated: false, completion: nil)
}))
self.present(alert, animated: false, completion: nil)
}
任何想法将不胜感激
【问题讨论】:
-
不是重复的。我的警报母猪,但之后我无法关闭它。
-
IMO 问题出在
viewDidAppear中,它不会调用super.viewDidAppear(animated)。 -
我现在添加了 super.viewDidAppear(animated) 并没有任何区别
-
可能你已经添加了两次警报。
标签: swift