I am using the tab bar application template and have added core data. Using the Core Data Books template, I am trying to create the sqlite3 database with the following:
Code:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
FirstViewController *rootViewController = (FirstViewController *)[tabBarController topViewController];
rootViewController.managedObjectContext = self.managedObjectContext;
// Add the tab bar controller's current view as a subview of the window
[window addSubview:tabBarController.view];
}
I have imported my firstviewcontroller.h file into the appdelegate.h file.
That is where it crashes with the message "Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UITabBarController topViewController]: unrecognized selector sent to instance".
I am not used to working with a XIB file so my thoughts are something is conflicting with my code and the XIB. Any suggestions would be appreciated.