I have three view controllers, a, b, and c. I start on a, and present b. If the user is logged out, c is presented. Otherwise I stay on b, where the below code snippet is from. If I only go from a to b, presentingViewController is setting to a and all is well. If c is presented, once I dismiss c, presentingViewController is returned nil and I am stuck on b.
UIViewController* parent = self.navigationController.presentingViewController;
self.navigationController.viewControllers = @[[[UIViewController alloc] init]];
[parent dismissModalViewControllerAnimated: NO];
[parent presentModalViewController: self animated: NO];
[parent dismissModalViewControllerAnimated: YES];
Solved by sending a reference of a to b and using that as the parent 🙂