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: 
My Solution would be to call dismissViewControllerAnimated: first and then pop the viewcontroller from navigation stack this works for me :-

```
[self dismissViewControllerAnimated:false completion:nil];
[myNavigationControllerInstance popToRootViewControllerAnimated:true]; // myNavigationControllerInstance = Your Navigation Controller Instance

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

```