I have Navigation controller as intial view which goes into view controller
now i have table view after this view
Nav controller > UI View Controller > Table view
Issue occurs here
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UINavigationController *navigationController = (UINavigationController *)self.window.rootViewController;
MasterViewController2 *controller = (MasterViewController2 *)navigationController.topViewController;
controller.managedObjectContext = self.managedObjectContext;
return YES;
}
app builds and fails with this message
'NSInvalidArgumentException', reason: '-[ViewController setManagedObjectContext:]: unrecognized selector sent to instance 0x8e22df0'
any idea why its failing and crashing app even though there is no build errors or warnings?
You need to set the class of your view controller in the storyboard to
MasterViewController2. The exception is showing you that the object is of typeViewControllerwith the message'-[ViewController setManagedObjectContext:]:. This is in the identity inspector (View → Utilities → Show Identity Inspector with your view controller selected).