TabBarController doesn't load ViewControllers with CoreData
It's strange but when I test my two ViewControllers separately, they work just fine. When they are inside of the TabBarController with the following code they don't work anymore - they don't get loaded. I have a breakpoint in the viewDidLoad method, which is not being called.
I had done a dummy of my project before I started working with CoreData and it was working perfectly with this code. So the problem started when the view controllers got their data from CoreData.
Thinking that CoreData was the problem, I decided to implement a UITabBarController in the CoreDataBooks example from Apple. It worked just fine.

I found some threads addressing some issues with CoreData and TabBarControllers but these where using IB. I don't have any .xib files in my project!  

I'm clueless.
Suggestions will be very appreciated!


    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        UITabBarController *tabBarController = [[UITabBarController alloc] init];
        
        ProjectRootViewController *projectRootViewController = [[ProjectRootViewController alloc] initWithStyle:UITableViewStylePlain];
        WorkTimeRootViewController *workTimeRootViewController = [[WorkTimeRootViewController alloc] initWithStyle:UITableViewStylePlain];
        
        NSManagedObjectContext *context = [self managedObjectContext];
        if (!context) 
        {
            NSLog(@"Problems loading context.");
        }
        
        projectRootViewController.managedObjectContext = context;
        workTimeRootViewController.managedObjectContext = context;
        
        UINavigationController *projectNavigationController = [[UINavigationController alloc] initWithRootViewController:projectRootViewController];
        UINavigationController *workTimeNavigationController = [[UINavigationController alloc] initWithRootViewController:workTimeRootViewController];
        
        [projectRootViewController release];
        [workTimeRootViewController release];
        
        navigationControllers = [[NSArray alloc] initWithObjects:projectNavigationController, workTimeNavigationController, nil];
        
        [projectNavigationController release];
        [workTimeNavigationController release];
        
        [tabBarController setViewControllers:navigationControllers];  
        
        [self.window addSubview:[tabBarController view]];
        
        [tabBarController release];
        
        [self.window makeKeyAndVisible];
        
        return YES;
    }
TabBarController doesn't load ViewControllers with CoreData
===

It's strange but when I test my two ViewControllers separately, they work just fine. When they are inside of the TabBarController with the following code they don't work anymore - they don't get loaded. I have a breakpoint in the viewDidLoad method, which is not being called.
I had done a dummy of my project before I started working with CoreData and it was working perfectly with this code. So the problem started when the view controllers got their data from CoreData.
Thinking that CoreData was the problem, I decided to implement a UITabBarController in the CoreDataBooks example from Apple. It worked just fine.

I found some threads addressing some issues with CoreData and TabBarControllers but these where using IB. I don't have any .xib files in my project!  

I'm clueless.
Suggestions will be very appreciated!


    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        UITabBarController *tabBarController = [[UITabBarController alloc] init];
        
        ProjectRootViewController *projectRootViewController = [[ProjectRootViewController alloc] initWithStyle:UITableViewStylePlain];
        WorkTimeRootViewController *workTimeRootViewController = [[WorkTimeRootViewController alloc] initWithStyle:UITableViewStylePlain];
        
        NSManagedObjectContext *context = [self managedObjectContext];
        if (!context) 
        {
            NSLog(@"Problems loading context.");
        }
        
        projectRootViewController.managedObjectContext = context;
        workTimeRootViewController.managedObjectContext = context;
        
        UINavigationController *projectNavigationController = [[UINavigationController alloc] initWithRootViewController:projectRootViewController];
        UINavigationController *workTimeNavigationController = [[UINavigationController alloc] initWithRootViewController:workTimeRootViewController];
        
        [projectRootViewController release];
        [workTimeRootViewController release];
        
        navigationControllers = [[NSArray alloc] initWithObjects:projectNavigationController, workTimeNavigationController, nil];
        
        [projectNavigationController release];
        [workTimeNavigationController release];
        
        [tabBarController setViewControllers:navigationControllers];  
        
        [self.window addSubview:[tabBarController view]];
        
        [tabBarController release];
        
        [self.window makeKeyAndVisible];
        
        return YES;
    }