title: Get data out of block iOS (Objective-C)
body: <p>So,here a simple method with a block</p>
  
  <pre><code>    -(void)getPointsInRange:(double)radius nearByPoint:(SGPoint *)nearByPoint
  {
      SGStorageQuery *query = [SGStorageQuery queryWithPoint:nearByPoint layer:SimpleGeoMainLayerName];
  
      [query setRadius:radius];
      [mainClient retain];
      [mainClient getRecordsForQuery:query
                        callback:[SGCallback callbackWithSuccessBlock:
                                  ^(id response) {
                                      // you've got records!
                                      // to create an array of SGStoredRecord objects...
  
                                      NSArray *records = [NSArray arrayWithSGCollection:response  type:SGCollectionTypeRecords];
                                      NSLog(@"records received:%i",[records count]);
  
                                      [self arrayOfPointsReceived:records];
                                  } failureBlock:^(NSError *error) {
                                      // handle failure
                                      NSLog(@"getPointsInRange error:%@",[error description]);
                                  }]];
  
  
  }
  </code></pre>
  
  <p>the method connects to some SDK and returns an NSArray with results.
  i want to find a way that the getPointsInRange method will return the NSArray.
  so its signature will be  <code>-(NSArray*)getPointsInRange...</code>
  I can do it simply with delegate, but  i'd like to do it all within one function.</p>