Cause 1.

self.navigationItem.leftBarButtonItems = [UIButton buttonWithType:UIButtonTypeSystem];
Copy the code

Will get system of vc navigationItem. BackBarButtonItem cause the system to return to failure.

2. Solve

In the VC, if you have BaseVC set it directly in BaseVC, and then disable popGestrure at the bottom of the stack. If you can’t disable popGestrure at the bottom of the stack, the first stack operation will fail.

self.navigationController.interactivePopGestureRecognizer.delegate = self; / / / and allow baseVC follow < UIGestureRecognizerDelegate >Copy the code

.M looks something like this

#import "UIBaseViewController.h" @interface UIBaseViewController () <UIGestureRecognizerDelegate> @end @implementation UIBaseViewController - (void)viewDidLoad { [super viewDidLoad]; Self. NavigationController. InteractivePopGestureRecognizer. Delegate = self} / / / disable sliding back - bottom of stack controller (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{ return self.navigationController.childViewControllers.count > 1; } @endCopy the code