Reputation: 271
I have following structure in Parse
Class_A
Class_B
Class_C
I am using following code to retrieve;
PFQuery *query = [PFQuery queryWithClassName:@"Class_A"];
[query includeKey:@"b_ID"];
[query includeKey:@"Class_B.c_ID"];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
// The find succeeded. The first 50 objects are available in object
self.myArray = [[NSArray alloc] initWithArray:objects];
} else {
// Log details of the failure
NSLog(@"Error: %@ %@", error, [error userInfo]);
}
}];
Now when it comes to display in UITableViewCell, I am using following code:
PFObject *aObject = [self.myArray objectAtIndex:indexPath.row];
PFObject *bObject = [aObject objectForKey:@"b_ID"];
PFObject *cObject = [bObject objectForKey:@"c_ID"];
I am getting issue with cObject. Can you please help?
Upvotes: 3
Views: 542
Reputation: 119041
Replace these lines:
[query includeKey:@"b_ID"];
[query includeKey:@"Class_B.c_ID"];
with
[query includeKey:@"b_ID.c_ID"];
and the query response will include both B
and C
objects.
Upvotes: 2