Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 8th, 2012  |  syntax: None  |  size: 0.50 KB  |  hits: 4  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. NSManagedObjectContext with private concurrency type executes block on main thread
  2. self.moc = [[[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType] autorelease];
  3. moc.parentContext = rootContext;
  4.        
  5. [self.moc performBlockAndWait:^() { // (1)
  6.     NSError* err = nil;
  7.  
  8.     result = [self.moc executeFetchRequest:request error:&err];
  9.  
  10.     NSLog(@"%@ %@", [NSThread currentThread], [NSThread isMainThread]?@"MAIN":@"");
  11. }];
  12.        
  13. <NSThread: 0x6b10780>{name = (null), num = 1} MAIN