declarationInfoController.fetchDeclarationInfo(with: searchBar.text!) { (declarationInfo) in
DispatchQueue.main.async {
if let declInfo = declarationInfo {
self.fetchedDeclarationInfo = declInfo
self.performSegue(withIdentifier: "declarationInfoSegue", sender: UIButton.self)
} else {
self.present(alertController, animated: true, completion: nil)
}
}
}
在我的应用程序中,我发出GET请求并在表视图中显示结果(如果未成功),以向警报控制器显示数据丢失。运行此代码,即使“ let declInfo = clarificationInfo”为true,我始终会看到警报控制器,然后转到tableview控制器。怎么了?!