I know this question was posted before, but answers I ´ve found are not according this case
The exception occurs after running an app wroten 2 years ago in Xcode 4.5.1.
This is:
exception 'UIViewControllerHierarchyInconsistency', reason: 'A view can only be associated with at most one view controller at a time! <UIView: 0xaa9c4f0; frame = (0 0; 320 367); autoresize = W+H; layer = > is associated with <TabledReservationListController: 0xaa89e80>. Clear this association before associating this view with <UIViewController: 0x9e9e310>.'
Then in several answers like this one
UIViewControllerHierarchyInconsistency when trying to present a modal view controller
suggest to remove the viewcontroller in the nib file like it can be seen on the question image.
The problem is that in this case , i don´t have the viewController, this is the nib file of TabledReservationListController:
And this is the part of the code where the app crashes:
- (void)viewDidLoad {
[super viewDidLoad];
[navigation setDelegate: self];
[self createReservationListController];
[reservationListController viewWillAppear: NO];
// in this line below
[[navigation topViewController] setView: [reservationListController view]];
[reservationListController viewDidAppear: NO];
[[self view] addSubview: [navigation view]];
CGRect r = [[self view] frame];
r.origin.y = 0;
[[navigation view] setFrame: r];
[reservationListController setNavigationController: navigation];
}
- (void)createReservationListController {
TabledReservationListController *res_ =
[[TabledReservationListController alloc] initWithNibName: @"TabledReservationListView"
bundle: nil];
[self setReservationListController: res_];
[res_ release];
[[[self navigation] topViewController] setTitle: @"Available Tables"];
}
Maybe someone could help, regards.