I have this problem on iOs6 on iOs5 works just fine.
this loads the LoginView
- (void)viewDidLoad {
if(!currentView ){
currentView = [[Login alloc] init];
}
self.view = currentView.view;
[super viewDidLoad];
}
And this is on AppDelegate
if (!mvc) {
mvc = [[[mainViewController alloc] init] autorelease];
}
[window addSubview:mvc.view];
[window sendSubviewToBack:mvc.view];
[window makeKeyAndVisible];
2013-01-15 18:02:33.137 fodboldfabrikken[5412:19d03] * Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'A view can only be associated with at most one view controller at a time! View > is associated with . Clear this association before associating this view with .'
* First throw call stack:
(0x2097012 0x1c78e7e 0x2096deb 0xa90309 0xb275ac 0xb23a90 0x3206 0xb23817 0xb23882 0x2b49 0xa3f7b7 0xa3fda7 0xa40fab 0xa52315 0xa5324b 0xa44cf8 0x2aafdf9 0x2aafad0 0x200cbf5 0x200c962 0x203dbb6 0x203cf44 0x203ce1b 0xa407da 0xa4265c 0x2a4d 0x2985 0x1)
libc++abi.dylib: terminate called throwing an exception
Best Answer
You are not allowed to have a controller inside another controller which is what you are doing here mvc = [[[mainViewController alloc] init] autorelease];