Question: I have encountered this warning:

> 
> pushViewController:animated: called on while an existing transition or presentation is
>  occurring; the navigation stack will not be updated.
> 
> 
> 

While trying to call `navigationController?.popViewControllerAnimated(false)` from `UIAlertController` completion block.

Answer: 
i am using **dispatch\_async** and **its working**. i tried to navigate back but didn't worked **because navigation stack will not be updated.**

```
let destVC = self.storyboard?.instantiateViewControllerWithIdentifier("HomeViewController") as! HomeViewController
    self.presentViewController(destVC, animated: true, completion: {() -> Void in
        dispatch_async(dispatch_get_main_queue(), {() -> Void in
            self.navigationController?.popViewControllerAnimated(true)!
        })
    })

```
Anyone needs go back to **PreviousVC** Use this code. **Swift5**

```
    dismiss(animated: true) {
        // If you need call someFunction()
        self.someFunction()
        self.navigationController?.popViewController(animated: true)
    }

```