0
votes

I am opening a navigationController using either directly navigation segue in storyboard or called segue from code, but still created on storyboard.

Example:

 self.performSegue(withIdentifier: "addNew", sender: nil)

Which then with modal transition opens a navigationController. NC then has a few view controllers on which all have close button on them and when I click on it it closes NC using:

self.navigationController?.dismiss(animated: true, completion: nil)

But afterwards when I switch between different ViewControllers on TabbarController or open some other view with push view I get:

Unbalanced calls to begin/end appearance transitions for

And also viewWillAppear on opened view isn't called. So can anyone tell me if I'm closing the NC correctly or is there some other way to prevent the error.

EDIT1: changed the closing call from controller.navigationController?.dismiss(animated: true, completion: nil)

to self.navigationController?.dismiss(animated: true, completion: nil) just to make the question easier.

Also tired:

self.dismiss(animated: true, completion:nil)

EDIT2: Is it maybe bad to open a NC from VC that is on NC that is on UITabbarController or is just simply already bad to have NavigationControllers as tabs on TabbarController?

1
self.navigationContro......Bista
@Oleg Gordiichuk don't think so, since if I never call other NC there problem dosen't appearschmru

1 Answers

3
votes

You may need to close the controller from that controller's side:

// place this to the target controller, which handles you that modal view
self.dismiss(animated: true) {
    //completion:
}

or

self.dismiss(animated: true, completion:nil)