title: managedObjectContext unrecognized selector sent to instance
body: <p>I am following a tutorial to develop an iOS app. I am using core data. The first view of the app is <code>RootViewController</code>. All Core Data stack is on the <code>AppDelegate</code> file. This is the part of the code from <code>AppDelegate.m</code> that makes the call to the <code>RootViewController</code> file:</p>
  
  <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {
    // Fetch the data to see if we ought to pre-populate
    NSError *error = nil;
    if (![[self fetchedResultsController] performFetch:&amp;error]) {
      NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
      abort();
    }
  
    [self loadFavoriteThingsData];        
  
    RootViewController *rootViewController = (RootViewController *)[navigationController topViewController];
    [rootViewController setManagedObjectContext:[self managedObjectContext]];       
  
    [window addSubview:[navigationController view]];
    [window makeKeyAndVisible];
    return YES;
  }
  </code></pre>
  
  <p>Now, in another part of the app I need to open a new view Controller that is a duplicate of <code>RootViewController</code>, called <code>DoneViewController</code>, but using other <code>NSPredicate</code>s to show other core data objects.</p>
  
  <p>In <code>RootViewController</code> there is a button to open the <code>MenuViewController</code> file, from there I try to open <code>DoneViewController</code> using following method:</p>
  
  <pre><code>- (IBAction)doneToDoaction:(id)sender {
      DoneViewController *viewController = [[DoneViewController alloc] init];
  
      [self presentViewController:viewController animated:YES completion:nil];
  }
  </code></pre>
  
  <p>but an exception is fired:</p>
  
  <pre><code>[MenuViewController managedObjectContext]: unrecognized selector sent to instance 0x145a0c00
  2013-12-26 22:58:23.688  *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MenuViewController managedObjectContext]: unrecognized selector sent to instance
  </code></pre>
  
  <p>I guess I have to pass the <code>managedObjectContext</code> from <code>RootViewController</code> to <code>MenuViewController</code> and then from <code>MenuViewController</code> to <code>DoneViewController</code>, but I don't know how to do it.</p>