title: Returning NSDictionary from async code block?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/9474018/returning-uiimage-from-block">returning UIImage from block</a>  </p>
  </blockquote>
  
  
  
  <p>Hi I'm trying to return dictionary of json twitter data so i can use it in my application. How ever it is being called from a async block. I can not save it or return it any thoughts?</p>
  
  <pre><code>  -(NSDictionary *)TweetFetcher
      {
  
      TWRequest *request = [[TWRequest alloc] initWithURL:
                            [NSURL URLWithString: @"http://search.twitter.com/search.json?
      q=iOS%205&amp;rpp=5&amp;with_twitter_user_id=true&amp;result_type=recent"] parameters:nil 
      requestMethod:TWRequestMethodGET];
  
  
      [request performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse 
      *urlResponse, 
      NSError *error)
       {
           if ([urlResponse statusCode] == 200) 
           {
               NSError *error;        
               NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:responseData 
               options:0 error:&amp;error];
  
  
               //resultsArray return an array [of dicitionaries&lt;tweets&gt;];
               NSArray* resultsArray = [dict objectForKey:@"results"]; 
               for (NSDictionary* internalDict in resultsArray)
  
                   NSLog([NSString stringWithFormat:@"%@", [internalDict 
               objectForKey:@"from_user_name"]]);
          ----&gt; return dict; // i need this dictionary of json twitter data
           }
           else
               NSLog(@"Twitter error, HTTP response: %i", [urlResponse statusCode]);
           }];
        }
  </code></pre>
  
  <p>Thnx in advance!</p>