objective c - Am I making two queries? -
since pffiles can retrieved through getdatainbackgroundwithblock because they're not objects (i think..) after making query i'm calling getdatainbackgroundwithblock convert pffile uiimage.
am making 2 queries calling findobjectinbackgroundwithblock , getdatabackgroundwithblock? if so, there way done 1 query only?
pfquery *query = [pfquery querywithclassname:@"photoobject"]; [query findobjectsinbackgroundwithblock:^(nsarray *objects, nserror *error){ (id object in objects) { 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]; }}]; } }];
you're making 2 asynchronous network requests, 1 of requests -- findobjects -- query. find returns object points file, , in order file's contents, second (non-query) request required.
there way you're doing single request client: cloud function same thing posted code, , returns retrieved data.
Comments
Post a Comment