3

I have following structure in Parse

Class_A

  1. objectID
  2. b_ID (this is a pointer having value as objectID to B)

Class_B

  1. objectID
  2. c_ID (this is a pointer having value as objectID to C)
  3. someParameterinB

Class_C

  1. objectID
  2. someParameterinC

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?

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.