Calling push and pop on the self at the same time will not work, as self has already been removed. You need to handle the stack of view controller -
UINavigationController *navigationController = self.navigationController;
NSMutableArray *activeViewControllers=[[NSMutableArray alloc] initWithArray: navigationController.viewControllers] ;
[activeViewControllers removeLastObject];
// Reset the navigation stack
[navigationController setViewControllers:activeViewControllers];
[navigationController pushViewController:yourViewController animated:YES];
Apart from this if you don't want this view controller , when popping from your new view controller, you have other options available.
Like firstVC
-> secondVC
-> thirdVC
Now from thirdVC
if you directly want to come to firstVC
(skipping secondVC, i believe which is why you want both push and pop). Then for this purpose you can use - popToViewController
.
[self.navigationController popToViewController:firstVC animated:YES];
Just checked that there are already couple of questions available on the same topic, you can refer those too for good opinion and answers-
How can I pop a view from a UINavigationController and replace it with another in one operation?
popping and pushing view controllers in same action
How to pop a viewController and then Push a viewController through delegation