Hi, I have a navigation controller. I created it a template from xcode (Universal App using Core Data), the implementation is the following:
Now this is all works fine, I added views and conections using Storymode with out any problems until I try to Embed In a Tab Bar Controller to my Navitagation Controller. here is crash log:
Obviously my TabBar is not set to be the topViewController, but because the template passes important data (managed Context). I don't want to mess around and move things.
Any advice is appreciated,
Thank you
Code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController;
UINavigationController *navigationController = [splitViewController.viewControllers lastObject];
splitViewController.delegate = (id)navigationController.topViewController;
UINavigationController *masterNavigationController = [splitViewController.viewControllers objectAtIndex:0];
MasterViewController *controller = (MasterViewController *)masterNavigationController.topViewController;
controller.managedObjectContext = self.managedObjectContext;
} else {
UINavigationController *navigationController = (UINavigationController *)self.window.rootViewController;
MasterViewController *controller = (MasterViewController *)navigationController.topViewController;
controller.managedObjectContext = self.managedObjectContext;
}
return YES;
}
Now this is all works fine, I added views and conections using Storymode with out any problems until I try to Embed In a Tab Bar Controller to my Navitagation Controller. here is crash log:
Code:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITabBarController topViewController]: unrecognized selector sent to instance 0x6e3c3b0'
Obviously my TabBar is not set to be the topViewController, but because the template passes important data (managed Context). I don't want to mess around and move things.
Any advice is appreciated,
Thank you