I have 8 tabs in an RSS News Reader. Each tab links to one navigation controller, which links to one masterViewController containing the table view. I am trying to loop through all the tabs to preload their table data at launch. I tried the code below in my appDelegate didFinishLaunchingWithOptions method:
UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
NSArray *myViewControllers = tabBarController.viewControllers;
for (UINavigationController *navViewController in myViewControllers)
{
[navViewController.topViewController view];
}
However, whenever I launch the Application, I get the following error message:
Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI
objectAtIndex:]: index 2147483647 beyond bounds [0 .. 7]'
What is the problem here?