解码JSON后从完成处理程序发出警报控制器

时间:2018-08-17 14:42:23

标签: json uialertcontroller completionhandler

 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)
            }
        }
    }

在我的应用程序中,我发出G​​ET请求并在表视图中显示结果(如果未成功),以向警报控制器显示数据丢失。运行此代码,即使“ let declInfo = clarificationInfo”为true,我始终会看到警报控制器,然后转到tableview控制器。怎么了?!

0 个答案:

没有答案