In my app, I have UIViewControllers A,B,C,D. What I do it traverse from A to B to C to D. Now the stack reads like A,B,C,D
I then remove C and D which are the top 2 items in the stack using
[self.navigationController popToViewController:BViewController animated:NO];
When I NSLog now I have A,B in the stack. Now when I try moving to C I get "nested push animation can result in corrupted navigation bar". I am puzzled why this is happening. Can anyone please help me in resolving this issue. Thanks for your time
EDIT From B I go to C using the below code
UIStoryboard *storybord = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *viewController = [storybord instantiateViewControllerWithIdentifier:@"C"];
[self.navigationController pushViewController:viewController animated:YES];
After this code is executed, there is an asynchronous code where we push to D
UIStoryboard *storybord = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *viewController = [storybord instantiateViewControllerWithIdentifier:@"D"];
[self.navigationController pushViewController:viewController animated:YES];
The stack now reads A,B,C,D. When I pop, the issue occurs
ASYNCHRONOUS CODE
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
if (error) {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setValue:@"messagehomescreen" forKey:@"lastscreenstatus"];
UIStoryboard *storybord = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *viewController = [storybord instantiateViewControllerWithIdentifier:@"D"];
[self.navigationController pushViewController:viewController animated:YES];
}
}];