UITabbarcontroller в IOS5 выдает исключение UIViewControllerHierarchyInconsistency

У меня есть следующий код для UITabbarcontroller:

NSMutableArray *arr = [[NSMutableArray alloc] init];
tabBarController = [[UITabBarController alloc] init];

FirstViewController *firstview = [[FirstViewController alloc] init];
[tabBarControllerViews addObject:firstview];
[firstview release];

 SecondViewController *secondview = [[SecondViewController alloc] init];
[tabBarControllerViews addObject:secondview];
[secondview release];

[tabBarController setViewControllers:arr animated:YES];
[arr release];

self.view = tabBarController.view;

Этот код отлично работает на IOS4. Я попробовал это на бета-версии IOS5 и получил следующую ошибку при нажатии на UITabbarItem:

*** Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency',
reason: 'child view controller:<FirstViewController: 0x6e03be0> should have parent view
controller:<MainViewController: 0x6816d20> but actual parent is:<UITabBarController: 0x6b0c110>'
15
задан user691219 8 June 2011 в 13:47
поделиться