title: Unable to set a context in a private queue as child of another context in main queue
body: <p>As far as I understood, it is possible to create an <code>NSManagedObjectContext</code> in a private queue and set its parent context to be another <code>NSManagedObjectContext</code> that belongs to main thread... isn't it?</p>
  
  <p>I'm trying to do this:</p>
  
  <pre><code>NSManagedObjectContext *privateContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType];
  AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
  NSManagedObjectContext *mainContext = appDelegate.managedObjectContext;
  [privateContext setParentContext:mainContext]; 
  </code></pre>
  
  <p>But I get a <code>SIGABRT</code> error at <code>[privateContext setParentContext:mainContext]</code> when I run this code.</p>
  
  <p>The <code>mainContext</code> I retrieve from <code>AppDelegate</code> is initialized in main thread, and this code snippet is also called in main thread. What could I doing wrong or missing?</p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT:</strong> If I instead do this (in <code>AppDelegate</code>):</p>
  
  <pre><code>NSManagedObjectContext *mainContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
  mainContext.persistentStoreCoordinator = self.managedObjectContext.persistentStoreCoordinator;
  NSManagedObjectContext *privateContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType];
  
  privateContext.parentContext = mainContext;
  </code></pre>
  
  <p>I get no error... why could this be happening? What does the default context provided in <code>AppDelegate</code> have that it doesn't work as parent context?</p>
  
  <p><strong>EDIT 2:</strong> The context in <code>AppDelegate</code> I'm trying to set as parent context is initialized by using the methods that are provided by default in <code>AppDelegate</code>:</p>
  
  <pre><code>- (NSManagedObjectContext *)managedObjectContext
  {
     // Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.)
     if (_managedObjectContext != nil) {
         return _managedObjectContext;
     }
  
     NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator];
     if (!coordinator) {
         return nil;
     }
     _managedObjectContext = [[NSManagedObjectContext alloc] init];
     [_managedObjectContext setPersistentStoreCoordinator:coordinator];
     return _managedObjectContext;
  }
  </code></pre>