This is the code:
UITabBarController *tbc = [[UITabBarController alloc]init];
tbc.viewControllers = [NSArray arrayWithObjects:ptlc,cvc,gvc,nil];
[self.navigationController pushViewController:tbc animated:YES];
[tbc release];
This is the last part of the code in tableView:didSelectRowAtIndexPath:. When selecting the row the UITabarController shows fine, but when hitting the “back” button on the UINavigationController, the program crashes after a second without printing any description on the console. The debugger just points me “Thread 1: Program received signal: “EXC_BAD_ACCESS”.” on this line:
int retVal = UIApplicationMain(argc, argv, nil, nil);
On “main.m”. Incredibly, removing the last line solves the problem. ptlc cvc and gvc are controllers which I first alloc inited and that I release after the last line of this code sample.
Solved it myself using the profile tool “zombies”. It showed me that an UIImage was receiving a release message after being deallocated. It was because I was using the same UIImage for two different UITabBarItems on the UITabBar.