0

我想一次将我查询的多个用户添加到 PFRelation。我该怎么做。是否所有用户信息都存储在 PFRelation 中,以便当前用户以后可以访问它?

//so now i am finding users in the PFRelation, but I cannot use the Users information in a table. The code for the table view is at the bottom. 
PFQuery * query =[self.matchesRelation query];
    [query orderByDescending:@"Score"];
    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        if (!error) {

            self.myMatches =[objects mutableCopy];
            [self.tableView reloadData];




        }

    }];




//code for the tableview, i can set the users username fine but anything else i cant

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString * CellIdentifier =@"Cell";
    customCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

    self.person =[self.myMatches objectAtIndex:indexPath.row];




    cell.name.text = self.person.username;
   //this does not work, why ? 
   cell.score.text =[self.person objectForKey:@"Score"];


    return cell;
}
4

1 回答 1

0

只需遍历self.myMatches数组中的项目,将每个项目添加到myMatches关系中。

完成后,只需保存包含关系的父对象,在您的情况下是[PFUser currentUser].

于 2015-01-12T06:00:56.750 回答