【发布时间】:2020-08-25 05:30:59
【问题描述】:
我有这个功能
func showMessageNew(msg:String,title: String){
let alertController = UIAlertController(title: title, message: msg, preferredStyle: .alert)
let okAction = UIAlertAction(title: "OK", style: .default)
alertController.addAction(okAction)
self.present(alertController, animated: true)
}
但是当我运行它时,我在控制台中有这个:whose view is not in the window hierarchy!
【问题讨论】:
-
为了显示警报,您需要一个父视图。你在哪里使用这个功能?
-
你的函数在 viewDidLoad o viewAppear 中吗?
标签: ios swift uialertcontroller