Search code examples
iosobjective-cparse-platformpfquerypfuser

Use PFQuery to get all PFUsers


I am trying to query all of the users of my app, and am using a PFQuery to do this. Here is the code I am using:

  PFQuery *query = [PFUser query];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
    if (!error) {
        // The find succeeded. The first 100 objects are available in objects
        NSLog(@"%lu", (unsigned long)objects.count);
    } else {
        // Log details of the failure
        NSLog(@"Error: %@ %@", error, [error userInfo]);
    }
}];

This code works but only gets the first 100 users. When I want to get all of mine, anyone know how to edit this or another way to write a query that will get all the users?

Thanks in advance.


Solution

  • You will have to set the limit of the query using query.limit, as well as query.skip to skip the users you have already queried. If you don't want to do this you can write and call a cloud code function that will return all of the users at once.