0

I am using a PFQuery in my iOS app to search for group names that already exist in a class on Parse.com. For my code, I have:

PFQuery *groupQuery = [PFQuery queryWithClassName:@"Group"];
    if ([groupQuery whereKey:@"GroupName" containsString:self.theView.signUpView.additionalField.text]) {
        NSLog(@"It Contains It %@", self.theView.signUpView.additionalField.text);
    }

The issue I am having is that it ALWAYS shows it contains it. For example, the name of a group I tried adding was Bazinga The current group names are YWAM YWAM Kona CRICS Teachers. Yet, it always showed that the query already contained a GroupName of Bazinga. What is going on here?

1 Answer 1

2

You need to execute the query

PFQuery *groupQuery = [PFQuery queryWithClassName:@"Group"];
[groupQuery whereKey:@"GroupName" containsString:self.theView.signUpView.additionalField.text]) 
[groupQuery findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error)
        {
            if (error == nil){
                // Great!  objects should only have the Group objects that contain thetext 
            }
            else{
                  // oops...check the error
            }
        }];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.