ios - PFQueryTableViewController bringing duplicate results - Pagination -
i using pfquerytableviewcontroller
retrieve objects parse database. using pagination improve performance of app. however, when ask load more objects queryfortable
gets executed again , bring same results again.
do guys know whether bug or there can do.
here code:
- (pfquery *)queryfortable { nslog(@"to aqui %@",self.location.name); pfquery *imagequery = [pfquery querywithclassname:@"wallimageobject"]; [imagequery wherekey:@"geopoint" neargeopoint:self.location.coordinatesingeopoint withinkilometers:0.5]; [imagequery wherekey:@"venuename" equalto:self.location.name]; [imagequery orderbydescending:@"createdat"]; // if pull refresh enabled, query against network default. if (self.pulltorefreshenabled) { imagequery.cachepolicy = kpfcachepolicynetworkonly; } // if no objects loaded in memory, cache first fill table // , subsequently query against network. if (self.objects.count == 0) { imagequery.cachepolicy = kpfcachepolicycachethennetwork; } return imagequery; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath object:(pfobject *)object { static nsstring *cellidentifier = @"cell"; feedphotocell *cell = (feedphotocell *)[tableview dequeuereusablecellwithidentifier:cellidentifier]; nsstring *facebbokuserid = object[@"userid"]; nsstring *urlstring = [nsstring stringwithformat:@"https://graph.facebook.com/%@/picture?width=100&height=100",facebbokuserid]; nsurl *facebookprofilepicurl = [nsurl urlwithstring:urlstring]; [cell.profilephoto setimagewithurl:facebookprofilepicurl]; cell.profilephoto.layer.cornerradius = 10.0; cell.profilephoto.layer.bordercolor = [uicolor colorwithred:235.0/255.0 green:80.0/255.0 blue:80.0/255.0 alpha:1.0].cgcolor; cell.profilephoto.layer.borderwidth = 1.0; cell.profilephoto.clipstobounds = yes; uiimageview *photoview = (uiimageview *)cell.photopost; pffile *imagefile = [object objectforkey:@"image"]; [imagefile getdatainbackgroundwithblock:^(nsdata *data, nserror *error){ photoview.image = [uiimage imagewithdata:data]; }]; return cell; }
ps: have done further tests , discovered issue happens when try [imagequery wherekey:@"geopoint" neargeopoint:self.location.coordinatesingeopoint withinkilometers:0.5];
regards
the thing imagine happening when invoke imagequery.cachepolicy = kpfcachepolicycachethennetwork; query being filled results cache , when load next page being filled results network duplicated second time
Comments
Post a Comment