I have started a master detail application using storyboard and core data. the managerObjContext is defined in the masterViewController:
@interface addMasterViewController : UITableViewController <NameEditorViewControllerDelegate>
...
@property (strong, nonatomic) NSManagedObjectContext *mngObjCntxt;
and synthesized in the m.file:
@implementation addMasterViewController
...
@synthesize mngObjCntxt=_mngObjCntxt;
now Im trying to set the mngObjCntxt in the application deligate but with no sucess. this is what I have tried:
#import "addAppDelegate.h"
#import "addMasterViewController.h"
#import "addDetailViewController.h"
@implementation addAppDelegate
@synthesize window = _window;
@synthesize splitViewController=_splitViewController;
@synthesize mngObjCntxt = _mngObjCntxt;
@synthesize mngObjModel = _mngObjModel;
@synthesize persistentStoreCoor = _persistentStoreCoor;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController;
UINavigationController *navigationController = [splitViewController.viewControllers lastObject];
splitViewController.delegate = (id)navigationController.topViewController;
[[[splitViewController viewControllers] objectAtIndex:0] setMngObjCntxt:[self mngObjCntxt]];
return YES;
}
the problem is that via the bolded expresion above im reaching the UINavigationController and not to the masterViewContoller, which hold the mngObjCntxt. so Im falling on the following error:-[UINavigationController setMngObjCntxt:]: unrecognized selector sent to instance how can I access the masterViewController frm the app deligate? thanks! Shimrit.