Reputation: 2773
Hello everyone I'm trying to display the profile picture of a user registered with the app.
In this query I am getting data from a different class from wherever it is in the photo databrowser. I tried with MatchesQuery but I can not find the right combination ... Probably my code is wrong ...
- (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;
}
Upvotes: 0
Views: 103
Reputation: 1581
After a little chat with you. The following code is unnecessary and wrong. So simple remove it and you are set:
PFQuery *RetrievePhoto_User = [PFUser query];
[RetrievePhoto_User whereKey:@"photo" matchesQuery:QueryForFriend];
Upvotes: 1