From Kinvey documentation this is the method to use for querying users:
To query the user collection we recommend instead using +[KCSUserDiscovery lookupUsersForFieldsAndValues:completionBlock:progressBlock:]. This method allows you to supply a dictionary of exact matches for special fields.
Fields for lookup:
- KCSUserAttributeUsername
- KCSUserAttributeSurname
- KCSUserAttributeGivenname
- KCSUserAttributeEmail
- KCSUserAttributeFacebookId
[KCSUserDiscovery lookupUsersForFieldsAndValues:@{ KCSUserAttributeSurname : @"Smith"}
completionBlock:^(NSArray *objectsOrNil, NSError *errorOrNil) {
if (errorOrNil == nil) {
//array of matching KCSUser objects
NSLog(@"Found %d Smiths", objectsOrNil.count);
} else {
NSLog(@"Got An error: %@", errorOrNil);
}
}
progressBlock:nil];
But if I send empty dictionary, I get an error. So what to put in dictionary to get all the users?
Thank you guys, happy holidays