title: Return Result of Completion Block
body: <p>So I'm trying to build a layer on top of the Twitter API (among others) for a project and I need to find a way to return the result of the Twitter actions to the layer of abstraction.</p>
  
  <p>Right now my setup is something like this, for example:</p>
  
  <pre><code>-(NSDictionary *)sendTweet:(Tweet *)tweet {
          __block NSMutableDictionary *responseDictionary;
  
      NSLog(@"Sending tweet");
  
      NSMutableDictionary *twitterRequestDictionary = [[NSMutableDictionary alloc] init];
      [twitterRequestDictionary setObject:tweet.tweetBody forKey:@"status"];
  
      TWRequest *request = [[TWRequest alloc] initWithURL:[NSURL URLWithString:@"https://api.twitter.com/1/statuses/update.json"]
                                               parameters:twitterRequestDictionary
                                            requestMethod:TWRequestMethodPOST];
      [request setAccount:self.userAccount];
  
  
      [request performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
          responseDictionary  = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:nil];
          NSLog(@"Response dictionary: %@", responseDictionary);
          return responseDictionary;
      }];
  </code></pre>
  
  <p>}</p>
  
  <p>But because the 'performRequestWithHandler:' method returns 'void' I the final line causes an error.</p>
  
  <p>I've also tried placing the 'return' statement outside of the block and locking the execution of the block section of code after discovering this article: <a href="http://omegadelta.net/2011/05/10/how-to-wait-for-ios-methods-with-completion-blocks-to-finish" rel="nofollow">http://omegadelta.net/2011/05/10/how-to-wait-for-ios-methods-with-completion-blocks-to-finish</a></p>
  
  <p>Still no luck.</p>
  
  <p>I hope someone can shed some light on this way to do it (or perhaps suggest a better method to return the data).</p>