Brandon A
Brandon A

Reputation: 8279

Parse iOS SDK: strange "cannot do a comparison query of type: (NULL)"

Scenario

I have been using the parse.com framework for over 6 months now on a project. It seems like it is very glitchy and full of bugs but this is something that I need to know if I'm doing it the right way. I am trying to use a PFQueryTableViewController to display similar user's info to a user. I use the code...

-(PFQuery *)queryForTable {

    PFQuery *matchQuery = [PFUser query];
    [matchQuery whereKey:@"mostCommon" equalTo:[PFUser currentUser][@"mostCommon"]];
    [matchQuery whereKey:@"userID" notEqualTo:currentUserID];
    return matchQuery;

}

Problem

When I run this and try to push this PFQTVC onto the stack, I get this error message...

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Cannot do a comparison query for type: (null)'

This is usually to do with not having your information set in the database. I am providing the image below to illustrate there IS indeed data in the data browser.

enter image description here

Question

So if the query is correct, and the data is there... THEN WHY IS THE APP CRASHING?

Upvotes: 0

Views: 1930

Answers (1)

Dehli
Dehli

Reputation: 5960

One problem you have is that in order to access the value for an object's key, you must use objectForKey: In your code, you use bracket notation which doesn't work with Parse objects.

[[PFUser currentUser] objectForKey:@"mostCommon"];

Upvotes: 3

Related Questions