我想要同时添加我查询到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;
}
答案 0 :(得分:0)
只需遍历self.myMatches
数组中的项目,将每个项目添加到myMatches
关系。
完成后,只需保存包含关系的父对象,在您的情况下为[PFUser currentUser]
。