I have the following tables name "aniStudii" and "discipline", I have made a screenshot as well:

As you can see, there is a relation between these tables, at the "materii" column. The row from "aniStudii" with the column "Anul I" has a value and the other column has a different value, values that can be found in the "discipline" table.
I am using this query to get the values, but all I get is Error: bad pointer for key: _p_materii (Code: 106, Version: 1.2.8)
This is my query:
PFQuery *query = [PFQuery queryWithClassName:@"aniStudii"]; //1
PFObject *aniStudiu = [PFObject objectWithClassName:@"discipline"];
[query whereKey:@"materii" equalTo:aniStudiu];
[query findObjectsInBackgroundWithBlock:^(NSArray *results, NSError *error) {
NSLog(@"%@",results);
}];
Where is the problem? A big thanks in advance.