0
votes

I'm trying to create a PFQuery of the user class, but the query should only contain objects with the value "male" from the "gender" column. The problem with my code is that all the values in the "gender" column contains the string "male". Both "female" and "male" contains "male". So the query contains both males and females now.

PFQuery *query = [PFUser query];
[query whereKey:@"gender" containsString:@"male"];

How can I make the query only contain the "male" objects? Any method? Or workaround?

1

1 Answers

2
votes

You could use a different query formatting call. By this I mean instead of using:

[query whereKey:@"gender" containsString:@"male"];

Why not use this:

[query whereKey:@"gender" equalTo:@"male"];

This is from https://parse.com/docs/ios/api/Classes/PFQuery.html#//api/name/whereKey:equalTo: