0
votes

I have a table called "UserSnapshot" on Parse and of course you get the objectID's as you populate the table.

However, when I query the table for an object from my app I wont have the object ID's but I will have their "UserCode". I have been playing with something like this.

    PFQuery *userProfile = [PFQuery queryWithClassName:@"UserSnapshot"];
[userProfile whereKey:@"Code" equalTo:_Code];
[userProfile getFirstObjectInBackgroundWithBlock:^(PFObject *object, NSError *error) {
    if (!object) {
        // Did not find PFObject
        // not executed
    } else {
        // Found PFObject
        // also not executed....huh?
    }
}];

But nothing happens. Neither the if or the else is entered. Am I missing something?

Thanks

2
Is there at least one object for it to actually find? Otherwise you should use findObjectsInBackground. - Frankie
Doesn't work either :( Seems to hit the line then complete skip over as if its failed. Not failed to get objects but failed failed. - Lewis Jenkins

2 Answers

0
votes

Does anything print out in the log/console? It's possible that you didn't set your keys properly when initializing Parse in your App Delegate.

0
votes
    PFQuery *userProfile = [PFQuery queryWithClassName:@"UserSnapshot"];
[userProfile whereKey:@"Code" equalTo:_Code];
PFObject *object = [userProfile getFirstObject];

Works!