In myAppDelegate.m:
MainViewController *mainViewController = [ [MainViewController alloc] init];
UINavigationController *navController = [[UINavigationController alloc]
initWithRootViewController:mainViewController];
[navController setNavigationBarHidden:YES];
[[self window] setRootViewController:navController];
In MainViewController.m nothing special, just one action tied to a button:
- (IBAction)go:(id)sender {
if (!whereamiViewController)
{
whereamiViewController = [[WhereamiViewController alloc] init];
}
[[self navigationController] pushViewController:whereamiViewController animated:YES];
}
And in WhereamiViewController.m just a button to show another screen in UINavigationViewController:
-(IBAction)showList:(id)sender
{
PointsViewController *container = [[PointsViewController alloc] init];
[[self navigationController] pushViewController:container animated:YES];
}
And:
@interface PointsViewController : UITableViewController
@end
Everything fine. But when I land on the last screen, PointsViewController, and I go back on WhereamiView, the app freeze, and Xcode shows a trap at CoureFoundation, CFHas.
Now, I know that Objective-C is not php, but this is a simple example indeed: what am I missing? There is a method to debug the problem?
The debugger says:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '- [__NSCFType _forgetDependentConstraint:]: unrecognized selector sent to instance
This morning I ran the app inside the simulator and no crashes!! How is it possible? If I run inside the iPhone crash, in the simulator no crash.
[PARTIALLY SOLVED]
This is very strange: After debugging everything and deleting every suspicious declaration, nothing improved. Same crash SIGABRT. After rebooting both iPhone and Mac, everything is fine!