I have a view, which is having two sub views, while adding those two subviews in tab bar it crashes in main. Following is the code..
block_list = [[ofi_vc_blocked_list alloc] init];
ab_blk_navig_controller = [[UINavigationController alloc] initWithRootViewController:block_list];
ab_navig_controller = [[UINavigationController alloc] initWithRootViewController:ab_window];
ab_tab_bar = [[UITabBarController alloc] init]; // ab_tab_bar is tab bar controller
ab_tab_bar.viewControllers = [NSArray arrayWithObjects:ab_navig_controller, ab_blk_navig_controller, nil];
While doing that, it crashes with following error:
Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'child view controller:<ofi_vc_address_book: 0x6868710> should have parent view controller:<ofi_vc_main_page_controller: 0x6c4b830> but actual parent is:<UITabBarController: 0x6869830>'
Any idea guys?
I have given an example , add the following statement for the first and the for the second tabBar2 .