title: Obj-C class method results from block
body: <p>I understand that this function first return "images" then "findObjectsInBackgroundWithBlock" retrieve data that's why results is nil.</p>
  
  <p>1 - how to return array from block? <br/>
  2 - how to put this block not in main thread?</p>
  
  <pre><code>+(NSMutableArray *)fetchAllImages{
          __block NSMutableArray *images = [NSMutableArray array];
          PFQuery *query = [PFQuery queryWithClassName:@"Photo"];
          [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
              if (!error) {
                  for (PFObject *object in objects) {
                      PFFile *applicantResume = object[@"imageFile"];
                      NSData *imageData = [applicantResume getData];
                      NSString *imageName = [ImageFetcher saveImageLocalyWithData:imageData FileName:object.objectId AndExtention:@"png"];
                      [images addObject:imageName];
                      // here images is not empty
                  }
              } else {
                  NSLog(@"Error: %@ %@", error, [error userInfo]);
              }
          }];
          // here images is empty
          return images;
      }
  </code></pre>