Facebookの友達情報とその写真のリストを取得するFQL
NSString *query = @"SELECT uid,name,first_name,last_name,pic_square FROM user WHERE uid IN (";
query = [query stringByAppendingFormat:@"SELECT uid2 FROM friend WHERE uid1 = %@)",userid];
NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
query, @"query",
nil];
[_facebook requestWithMethodName: @"fql.query"
andParams: params
andHttpMethod: @"POST"
andDelegate:self];
次の方法で応答が得られます
-(void)request:(FBRequest *)request didLoad:(id)result
例えば
{
"first_name" =User;
"last_name" = R;
name = "User R";
"pic_square" = "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash2/.jpg";
uid = 595sd1;
}
{},{} etc
お役に立てれば!
別の方法は
ユーザーの ID (またはニックネーム) を取得し、https://graph.facebook.com/idOrNick/pictureから画像を取得します
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://graph.facebook.com/%@/picture", id]];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *image = [UIImage imageWithData:data];
UIImageView *imgView = [[UIImageView alloc]init];
imgView.image = image;
そしてサイズについて
写真サイズ:正方形(50×50)
小 (幅 50 ピクセル、高さ可変)
大 (幅約 200 ピクセル、高さ可変)
このタイプのサイズを適用するには、URL の末尾に追加する必要があります
例えば
http://graph.facebook.com/ "id or Nick"/picture?type=large. 【小・角・大】