2015-06-20 74 views
3

我具有以下如何檢索來自第二級指針值在解析用於使用目標C

Class_A結構解析的iOS

  1. 的objectID
  2. B_ID(這是一個具有值指針的objectID到B)

Class_B

  1. 的objectID
  2. C_ID(這是一個具有值指針的objectID至C)
  3. someParameterinB

Class_C

  1. 的objectID
  2. someParameterinC

我使用以下代碼來檢索;

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]); 
     } 
    }]; 

現在,當談到在UITableViewCell中顯示,我使用下面的代碼:

PFObject *aObject = [self.myArray objectAtIndex:indexPath.row]; 

PFObject *bObject = [aObject objectForKey:@"b_ID"]; 

PFObject *cObject = [bObject objectForKey:@"c_ID"]; 

我得到的問題與CObject的。你能幫忙嗎?

回答

1

替換這些行:

[query includeKey:@"b_ID"]; 
[query includeKey:@"Class_B.c_ID"]; 

[query includeKey:@"b_ID.c_ID"]; 

和查詢響應將包括BC對象。