Getting PFObject from Parse Relation

28 views Asked by At

I have a PFRelation between Users and Offers that the User saved. Each Offer has a pointer reference to a Product PFObject. Even though I am getting the Offers saved for the particular User, the Product PFObject inside the Offer PFObject is not returning completely. Below the code I tried:

PFUser *user = [PFUser currentUser]; PFRelation *relation = [user relationForKey:@“offersSaved”]; [[relation query] includeKey:@“offersSaved.product”];

The array returned from fetch contains all the offers I want, but the offers don’t contain the product PFObjects as I would like. Any suggestions?

1

There are 1 answers

0
Davi Macêdo On

try this:

PFUser *user = [PFUser currentUser];
PFRelation *relation = [user relationForKey:@“offersSaved”];
PFQuery *query = [relation query];
[query includeKey:@“product”];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
    // ...
}];