objective c - Retrieve images from Parse along its geolocation -


i geolocations annotations on map , show user related image same row in custom view.

i've tried saving pffiles in dictionary along objectids because i'm setting each annotation's title location's objectid gives me - [pfobject objectid]: unrecognized selector sent instance.

this i'm doing.

pfquery *query = [pfquery querywithclassname:@"photoobject"];      [query findobjectsinbackgroundwithblock:^(nsarray *objects, nserror *error){          (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");           }      }]; 

and then

- (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;} 

edit

i've realized had in order make work pffiles

pffile *imagefile = object[@"photo"];             [imagefile getdatainbackgroundwithblock:^(nsdata *imagedata, nserror *error) {                 if (!error) {                     self.calloutimage = [uiimage imagewithdata:imagedata];                   }}]; 

but still not working.

solved it..

pffile *imagefile = object[@"photo"];             [imagefile getdatainbackgroundwithblock:^(nsdata *imagedata, nserror *error) {                 if (!error) {                      [self.annotationarray addobject:object[@"location"]];                     nslog(@"annotation's coordinate : %@", self.annotationarray);                       self.calloutimage = [uiimage imagewithdata:imagedata];                      self.geopoint = object[@"location"];                      cllocationcoordinate2d loccoord = cllocationcoordinate2dmake(self.geopoint.latitude, self.geopoint.longitude);                     custompin *pin = [[custompin alloc] initwithtitle:[object objectid] location:loccoord image:self.calloutimage];                     [self.mainmap addannotation:pin];                  }}]; 

i had set images inside getdatainbackgroundwithblock since i'm getting pffiles uiimages in background otherwise images no data.


Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -