I am using this query to find users, it works but it just shows me the first user. I want it to show me the user with the text of an UITextField. How can I do that ? (I have a textfield and there I type in a name and then it should show the parsed users with the name)
PFQuery *query = [PFUser query];
NSArray *users = [query findObjects];
userQuerys.text = users[0][@"username"];
Thanks very much
This code will fetch you all the
PFUser
s in whichusername
is equal to thename
parameter:An example, if you need to update the UI with the result, for example, a table:
A small note: the completionBlock here wont run if there is an error, but it will run even if no users were found, so you gotta treat that (if needed. in this example, it was not needed).
Avoid running non-UI related logic on that mainQueue method, you might lock the Main thread, and that`s bad user experience.