【发布时间】:2023-03-28 17:25:01
【问题描述】:
我有时会在致电UIAlert 时收到此警告
尝试加载视图控制器的视图 不允许解除分配,并可能导致未定义的行为 ()
code used:
func alert (dictKey: String){
print(dictKey)
let alertController = UIAlertController(title: nil, message: promptsArr[dictKey], preferredStyle: .Alert )
let OKAction = UIAlertAction(title: "OK", style: .Default) { (action) in
}
alertController.addAction(OKAction)
if self.presentedViewController == nil {
delay(1.0){
self.presentViewController(alertController, animated: true, completion: nil)
}
} else {
self.presentedViewController!
}
【问题讨论】:
-
你在哪里以及如何调用这个方法?
-
从此开关代码中: func resultOfValidation (dictKey: String, tag: Int) { delay(0.3){ switch dictKey { case "SendVeriCode": //SMS sent //Server code will have to在不同名称下搜索单元格编号的先前条目 _ = self.alert(dictKey) if (tag
-
请将该代码也添加到问题中。
标签: ios swift uialertcontroller