나는 모든 사용자의 Facebook 친구들을 가져 와서 테이블 뷰에로드하려고합니다. (간단히 FBFriendPickerViewController를 사용하지만 추악하고 수정하지 못할 수도 있습니다. 그)Facebook 데이터를 테이블 뷰에로드 중
내가 원하는 건 셀 imageView의 프로필 사진과 셀 textLabel의 이름이다.
NSURL/NSData를 사용하면 이미지를 자르지 않습니다. Id는 FBProfilePictureView를 사용하므로 많은 솔루션에서 사용하십시오. 감사!
-(void)facebookOpenSession {
if (FBSession.activeSession.isOpen) {
[[FBRequest requestForMyFriends] startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (error) {
// handle error
} else {
self.facebookFriends = [NSArray arrayWithArray:[result objectForKey:@"data"]];
[[NSNotificationCenter defaultCenter] postNotificationName:@"facebookRequestForMyFriends" object:self];
}
}];
}
}
구성 데이터 셀에 페이스 북에서 데이터를 가져 사람들이 페이스 북 SDK와 모든 일을하는 방법을 배울 어떻게
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
// Configure the cell...
NSDictionary<FBGraphUser> *friend = [self.facebookFriends objectAtIndex:indexPath.row];
cell.textLabel.text = friend.name;
NSURL *profilePictureUrl = [NSURL URLWithString:[NSString stringWithFormat:@"http://graph.facebook.com/%@/picture?type=normal", friend.id]];
NSData *profilePictureData = [NSData dataWithContentsOfURL:profilePictureUrl];
cell.imageView.image = [UIImage imageWithData:profilePictureData];
return cell;
}
, 내가 무엇을하려고 약 4 시간 소요 위에서 설명한 바와 같이 나는 뭔가를 완전히 놓친 것처럼 느낍니다.