In my project I'm using a tabBarController as the rootView Controller, then on one of my tabs, I add my exsisting ToDoList application. The problem I'm having is this: If I use this code in the AppDelegate: ToDoList is load as RootView. But I want it to show only after appropriate tab selected.
- (void)applicationDidFinishLaunching:(UIApplication *)application {
//todoRootController.managedObjectContext = self.managedObjectContext;
ToDoRootViewController *todoRootViewController = [[ToDoRootViewController alloc]initWithNibName:@"ToDoRootViewController" bundle:nil];
NSManagedObjectContext *context = [self managedObjectContext];
if (!context) {
// Handle the error.
}
// Pass the managed object context to the view controller.
todoRootViewController.managedObjectContext = context;
UINavigationController *aNavigationController = [[UINavigationController alloc]
initWithRootViewController:todoRootViewController];
self.navigationController = aNavigationController;
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
[todoRootViewController release];
[aNavigationController release];
}
The I replace applicationDidFinishLaunching:(UIApplication *)application method as CoreDataReceipeis sample code
- (void)applicationDidFinishLaunching:(UIApplication *)application {
todoRootController.managedObjectContext = self.managedObjectContext;
//////////////// same stuff
}
But then it gives 'NSInternalInconsistencyException', reason: '+entityForName: could not locate an NSManagedObjectModel for entity name 'Task''