我在ViewController中执行UIAlertViewController时出现问题。在执行UIAlertController时出现nil
这是我目前有
func displayLoginResult(viewModel: Login.PerformLogin.ViewModel) {
endLoader(loader: loaderLogin)
if let errorMessage = viewModel.displayedError {
print(errorMessage.message)
let alert = UIAlertController(title: "Error", message: "Enter data in Text fields", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
self.presentViewController(alert, animated: true, completion: nil)
}
else {
router.navigateToGroupsScene()
}
}
我已经试过删除DerivedData但没有。我只是考虑viewModel.displayedError不是零的情况(不是其他情况,只是如果)。我已经看到了,如果我评论这一行:
self.presentViewController(alert, animated: true, completion: nil)
所有的作品,但显然任何对话框,显示这不是我想要的。我有点沮丧,因为我从来没有像这样的问题,Xcode提供了我没有太多的信息。
您需要任何进一步的信息,只是让我知道,我会为您提供!
非常感谢。
你是什么'self'?那是'无'吗? – Tj3n