title: performBlockAndWait: to save a root managed object context synchronously doesn't provide non temporary Object IDs
body: <p>Following the iOS5 release notes and WWDC2011 presentation examples, I setup a root managed object context as type <strong>NSPrivateQueueConcurrencyType</strong>. I have a child context which is of type <strong>NSMainQueueConcurrencyType</strong> (referred to as the default context).</p>
  
  <p>When I save the child context, then save the root context using the block API: <code>performBlockAndWait:</code>, I expect the operation to by synchronous. </p>
  
  <p>That is, right after this block executes, I should be able to get non-temporary <strong>ObjectID</strong>'s for all the objects just inserted all the way to the data store.</p>
  
  <p>However, I instead, get <em>temporary</em> object IDs! It's as if the <code>performBlockAndWait:</code> degenerates to <code>performBlock:</code> and runs async. But why?</p>
  
  <p>Is this a bug, or am I missing some key assumption?</p>
  
  <p>Here's some relevant code:</p>
  
  <pre><code>// Setup of the root MOC:
  __rootContext = [[NSManagedObjectContext alloc] 
      initWithConcurrencyType:NSPrivateQueueConcurrencyType];
  [__rootContext setPersistentStoreCoordinator:[self coordinator]];
  
  // Setup of the child MOC; I use it as the "default" context:
  __defaultContext = [[NSManagedObjectContext alloc] 
      initWithConcurrencyType:NSMainQueueConcurrencyType];
  [__defaultContext setParentContext:__rootContext];
  
  // Here's the essence of the save operation:
  [__defaultContext save:&amp;error]
  
  // Setup a block I can invoke that does the save:
  void (^rootContextSaveOperation)(void) = ^{
      NSError *rootContextError = nil;
      BOOL wasRootContextSaveSuccessful = [rootContext save:&amp;rootContextError];
      if (!wasRootContextSaveSuccessful) { 
          NSLog(@"RPDataStore: Error saving root context."); }
      };
  
  // Call perform block and wait with the operation:
  [__rootContext performBlockAndWait:rootContextSaveOperation];
  
  // Now when I inspect one of the objects just saved, I have this check in my unit test:
  BOOL isTempID = [[user objectID] isTemporaryID];
  </code></pre>
  
  <p>The problem is, for the "user" object part of the MOC hierarchy just saved from it's leaf MOC to the root, the "isTempID" flag unfortunately, reveals "YES".</p>
  
  <p>My expectation was that I could perform a save synchronously to get a permanent Object ID I could use in other contexts.</p>
  
  <p>Are my conceptual expectations of <code>performBlockAndWait:</code> incorrect?</p>
  
  <p>If so, how do I save synchronously with this MOC queue configuration and still get non-temporary ObjectIDs right away?</p>