放松之后显示警报继续停止继续。 如何确保在放松继续完成后显示警报?

从视图控制器到B视图控制器,我有一个放松的过程。

networking操作在B完成。操作完成后,响应将显示在视图控制器中。

我成功地做了这个结构。 但是有一个问题:

当我尝试显示警报时,显示但停止了继续。 如何在赛季完成后确保提醒显示。

错误在这里:

2016-04-27 14:39:28.350 PROJECT[9100:128844] Presenting view controllers on detached view controllers is discouraged <PROJECT.FeedTableViewController: 0x7a928c00>. 2016-04-27 14:39:28.359 PROJECT[9100:128844] popToViewController:transition: called on <UINavigationController 0x7c12a800> while an existing transition or presentation is occurring; the navigation stack will not be updated. 

A:中的展开处理程序

 @IBAction func unwindToFeed(segue: UIStoryboardSegue) { jsonArray[rowFromShare!]["ApplicationDataUsers"] = jsonFromShare! tableView.reloadData() ShowErrorDialog("Success", message: successMessageFromShare!, buttonTitle: "OK") } //Error Dialog func ShowErrorDialog(title:String, message:String, buttonTitle:String){ let alert = UIAlertController(title: title, message: message, preferredStyle: .Alert) alert.addAction(UIAlertAction(title: "OK", style: .Default) { _ in }) self.presentViewController(alert, animated: true){} } 

在B中展开扳机:

 override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "unwindToFeed"{ let feedTable = segue.destinationViewController as! FeedTableViewController feedTable.rowFromShare = row feedTable.jsonFromShare = jsonToShare feedTable.successMessageFromShare = successMessageToShare } // Get the new view controller using segue.destinationViewController. // Pass the selected object to the new view controller. } 

A = FeedTableViewController B = ShareTableViewController

如何确保在完成完成后显示警报?

unwindToFeed方法在unwind segue完成之前被调用,就像你find的那样。

一种方法是在unwindToFeed方法中设置一个布尔值,然后在viewDidAppear检查这个布尔值,当你知道这个segue已经完成的时候。 如果布尔值被设置,那么你可以显示警报:

 @IBAction func unwindToFeed(segue: UIStoryboardSegue) { jsonArray[rowFromShare!]["ApplicationDataUsers"] = jsonFromShare! tableView.reloadData() self.unwinding = true } override func viewDidAppear(animated: Bool) { super.viewDidAppear(animated) if (self.unwinding) { self.ShowErrorDialog("Success", message: successMessageFromShare!, buttonTitle: "OK") self.unwinding=false }