title: Dealing with Blocks, completion handlers, dispatch_async vs dispatch_sync
body: <p>I'm executing an online fetch of data in a thread and I want to do something immediately after the block is executed. </p>
  
  <p>Here's my code:</p>
  
  <pre><code>- (IBAction)refresh:(UIBarButtonItem *)sender {
      NSLog(@"checking");
      [self editToolbar];
      dispatch_queue_t fetchQ = dispatch_queue_create("Refreshing", NULL);
      dispatch_async(fetchQ, ^{
          [self setupFetchedResultsController];
          [self fetchImonggoItemsDataIntoDocument: self.itemDatabase];
      });
      dispatch_release(fetchQ); 
  
      NSLog(@"done checking");
      //do something here
  }
  </code></pre>
  
  <p>The thing is dispatch_async returns immediately and "done checking" prints immediately even before the block is done executing. How do I solve this?</p>