How to get value from second level pointer in Parse for iOS using Objective-C
I have the following structure in Parse
Class_A
- ObjectId
- b_ID (this is a pointer having a value as objectID for B)
Class_B
- ObjectId
- c_ID (this is a pointer that has a value as objectID for C)
- someParameterinB
Class_C
- ObjectId
- someParameterinC
I am using the following code to extract;
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 displaying in a UITableViewCell, I am using the following code:
PFObject *aObject = [self.myArray objectAtIndex:indexPath.row];
PFObject *bObject = [aObject objectForKey:@"b_ID"];
PFObject *cObject = [bObject objectForKey:@"c_ID"];
I have a problem with cObject. Could you help me?
+3
source to share