大家好我正在尝试显示使用该应用注册的用户的个人资料图片。
在这个查询中,我从不同的类中获取数据,而不是它在照片数据库中的位置。我尝试使用MatchesQuery,但我找不到合适的组合...可能我的代码错了......
- (void)QueryForTableView {
PFQuery *QueryForFriend=[PFQuery queryWithClassName:@"Amicizie"];
[QueryForFriend whereKey:@"A_User" equalTo:[PFUser currentUser]];
[QueryForFriend includeKey:@"Da_User"];
PFQuery *RetrievePhoto_User = [PFUser query];
[RetrievePhoto_User whereKey:@"photo" matchesQuery:QueryForFriend];
[QueryForFriend findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
NSLog(@"nome:%@", objects);
self.UtentiInAttesa = objects ;
[self.FFTableView reloadData];
}
}];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"CellaAmici";
FFCustomCellFriendInAttesa *cell = [self.FFTableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
if (!cell) {
cell = [[FFCustomCellFriendInAttesa alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CellaAmici"];
}
PFUser *FriendUser = [self.UtentiInAttesa objectAtIndex:indexPath.row];
NSString *ValueNomeCognome = [[FriendUser objectForKey:@"Da_User"] valueForKey:FF_USER_NOMECOGNOME];
cell.FFNomeFriendLabel.text = ValueNomeCognome;
cell.FFFotoProfiloInAttesa.file = [FriendUser objectForKey:@"photo"];
cell.FFFotoProfiloInAttesa.image = [UIImage imageNamed:@"FFNoFotoUSer"];
[cell.FFFotoProfiloInAttesa.layer setMasksToBounds:YES];
[cell.FFFotoProfiloInAttesa.layer setCornerRadius:22.5f];
[cell.FFFotoProfiloInAttesa loadInBackground];
return cell;
}
答案 0 :(得分:1)
与你聊天后。以下代码是不必要和错误的。如此简单的删除它并设置:
PFQuery *RetrievePhoto_User = [PFUser query];
[RetrievePhoto_User whereKey:@"photo" matchesQuery:QueryForFriend];