title: Retrieve images from Parse along its geolocation
body: <p>I get geolocations for annotations on map and would like to show user related image from the same row in a custom view.</p>
  
  <p>I've tried saving PFFiles in a dictionary along with ObjectIDs because I'm setting each annotation's title its location's ObjectID but that gives me - <em>[PFObject objectID]: unrecognized selector sent to instance</em>.</p>
  
  <p>This is what I'm currently doing.</p>
  
  <pre><code>PFQuery *query = [PFQuery queryWithClassName:@"photoObject"];
  
      [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error){
  
          for (id object in objects) {
  
  
              [self.annotationArray addObject:object[@"location"]];
              NSLog(@"Annotation's coordinate : %@", self.annotationArray);
  
              UIImage *image = [UIImage imageWithData:object[@"photo"]];
  
              [self.imageFileDict setObject:object[@"photo"] forKey:[object objectID]];
              NSLog(@"imageFileDict : %@", self.imageFileDict);
  
              self.geoPoint = object[@"location"];
  
              CLLocationCoordinate2D locCoord = CLLocationCoordinate2DMake(self.geoPoint.latitude, self.geoPoint.longitude);
              CustomPin *pin = [[CustomPin alloc] initWithTitle:[object objectId] location:locCoord image:image];
              [self.mainMap addAnnotation:pin];
  
              NSLog(@"Adding annotation");
  
  
          }
  
      }];
  </code></pre>
  
  <p>And then</p>
  
  <pre><code>- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view {
  
  CustomPin *pin = (CustomPin *)[view annotation];
  NSLog(@"selected pin's objectID : %@",pin.title);
  
  UIImageView *callOutview = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.width)];
  [self.view addSubview:callOutview];
  callOutview.backgroundColor = [UIColor yellowColor];
  
  callOutview.image = pin.image;}
  </code></pre>
  
  <p><strong>Edit</strong></p>
  
  <p>I've realized I had to do this in order to make it work with PFFiles</p>
  
  <pre><code>PFFile *imageFile = object[@"photo"];
              [imageFile getDataInBackgroundWithBlock:^(NSData *imageData, NSError *error) {
                  if (!error) {
                      self.callOutImage = [UIImage imageWithData:imageData];
  
  
                  }}];
  </code></pre>
  
  <p>But still not working. </p>