findObjectsInBackgroundWithBlock Parse not working

295 views Asked by At

We are using "findObjectsInBackgroundWithBlock" method of PFQuery to query some table of our Parse database. The Table contains 23.3k rows. We are querying for a particular "EmailId" in the table. This find method is working randomly. It sometimes does not returns me the object whereas the email id exists in the table. Is there any limit restrictions.

My code snippet is :

PFQuery *query = [PFQuery queryWithClassName:Login_Table];

[query whereKey:Login_Email equalTo:[user.userEmail lowercaseString]];

[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error)
 {
     if (!error) {
         // The find succeeded.
         NSLog(@"Successfully retrieved %lu scores.", (unsigned long)objects.count);

         if ([objects count] > 0)
         {
             loginResult(YES,objects);
         }
         else
         {
             loginResult(NO,objects);
         }
     }
     else {
         // Log details of the failure

         loginResult(NO,objects);
         NSLog(@"Error: %@ %@", error, [error userInfo]);
     }
 }];
1

There are 1 answers

2
Utsav Parikh On

You can use a simple query with no constraints to obtain up to 100 objects, but anything from 1 to 1000 is a valid limit.

You need to query again for the next objects by setting limit and skip properties of PFQuery. Similarly you need to query again and again until you reach your total count.

Follow the guide : https://parse.com/docs/ios/guide