Anju
Anju

Reputation: 27

how to get friends profile image in friend list of facebook

I am creating a iPhone app in which i have to show friend list with their images. I am using Facebook graph api. i am getting the friends id and name but not the images. So please suggest me how i can get this?

Upvotes: 0

Views: 857

Answers (1)

Karthikeyan
Karthikeyan

Reputation: 1790

Write a FQL to get list of facebook friends & their Pics

 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]; 

you will get a array in u r

  -(void)request:(FBRequest *)request didLoad:(id)result 

Sample { "first_name" =User; "last_name" = R; name = "User R"; "pic_square" = "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash2/.jpg"; uid = 595sd1; } {},{} etc

Hope this helps!

Upvotes: 1

Related Questions