I use the following code to handle failed requests.
- (void)requestFailed:(ASIHTTPRequest *)request {
[self.alertView dismissWithClickedButtonIndex:0 animated:YES];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Request failed." message:requestFailMessage delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[self.navigationController popViewControllerAnimated:YES];
}
To simulate, I turn on “Airplane Mode.” I try the request, and it fails. After I press the “OK” button, I am greeted with this error:
2012-03-28 02:23:56.048 Obfuscated[40835:207] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
Basically, I just want the navigationController to go back to the previous view controller when the request fails. However, this does not seem to work.
What can I do to fix this?
I think you use
popViewControllerAnimatedtwice once below the alert code and once in you delegate for alert method.Sice your navigation stack not having view to pop so it gives you this problem.
Do like this