ios - PFQuery FindObjectsInBackground Returns 0 -


in uiviewcontroller trying query parse server, keep getting return of 0 it, though know 100% class have objects in it. thoughts?

 pfquery *query = [pfquery querywithclassname:@"general"];   int i;  (i = 0; < [follows count]; i++) {         [query wherekey:@"session" containedin:follows];  }  query.cachepolicy = kpfcachepolicycachethennetwork;   [query orderbydescending:@"createdat"];  [query findobjectsinbackgroundwithblock:^(nsarray *objects, nserror *error) {  // never gets here...  nslog(@"objects%@", objects);  if (!error) {      nslog(@"successfully retrieved %lu objects.", (unsigned long)objects.count);      (pfobject *object in objects) {          nslog(@"%@", object.objectid);      }       // [self gotomain];  } else {        nslog(@"error: %@ %@", error, [error userinfo]);    }  }]; 

it tells me there no error retrieved 0 objects in console.

as other suggested, first simplest query:

pfquery *query = [pfquery querywithclassname:@"general"];  [query findobjectsinbackgroundwithblock:^(nsarray *objects, nserror *error) {  if (!error) {      nslog(@"successfully retrieved %lu objects.", (unsigned long)objects.count);  } else {        nslog(@"error: %@ %@", error, [error userinfo]);    }  }];   

if executed without error, returns 0 objects, , dashboard shows there objects should returned, class name must wrong. please double check class name, e.g. spelling.

if objects returned, filter must wrong. for wrong 2 reasons anywhere:
1) loop executed follows.count - times, executes same instruction, since index not used. guess wanted write (but wrong)

 (i = 0; < [follows count]; i++) {         [query wherekey:@"session" containedin:follows[i]];  }   

2) wrong because can have single filter wherekey:containedin:. has been mentioned devkyle, single filter overwritten follows.count-1 - times, , last filter used.
guess wanted have logical or of individual filters. if so, had flatten array, i.e. make single array nsarray *flattenedfollows of elements in follows[i], see here , set single filter

 [query wherekey:@"session" containedin: flattenedfollows];   

edit:
1 last idea: if query correct (besides of loop) , no object returned anyway, might don't have right access them. so, please, check acl field of these records has correct access rights.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -