簡體   English   中英

安裝了相同應用的Facebook Friends Profile Picture

[英]Facebook Friends Profile Picture who installed the same apps

我需要顯示誰安裝了相同應用程序的Facebook好友列表。 我使用“ Facebook-Graph-API”獲得了“ FriendName”和“ FriendID”。 但我沒有得到“ FriendProfile圖片”。 我正在使用此代碼:

[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:@{@"fields": @"id,name,link,first_name, last_name, picture.type(large), email, birthday,friends,gender,age_range,cover"}]
     startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
         if (!error)
         {
             //NSLog(@"result is :%@",result);
             NSLog(@"User ID : %@",[result valueForKey:@"id"]);
             NSLog(@"User Name : %@",[result valueForKey:@"name"]);
             NSLog(@"User First Name :%@",[result valueForKey:@"first_name"]);
             NSLog(@"User Last Name :%@",[result valueForKey:@"last_name"]);
             NSLog(@"USER Email is :%@",[result valueForKey:@"email"]);

             NSLog(@"User total friends : %@",[[[result valueForKey:@"friends"]objectForKey:@"summary"]valueForKey:@"total_count"]);


             //Friend List ID And Name
             NSArray * allKeys = [[result valueForKey:@"friends"]objectForKey:@"data"];

             fb_friend_Name = [[NSMutableArray alloc]init];
             fb_friend_id  =  [[NSMutableArray alloc]init];

             for (int i=0; i<[allKeys count]; i++)
             {
                 [fb_friend_Name addObject:[[[[result valueForKey:@"friends"]objectForKey:@"data"] objectAtIndex:i] valueForKey:@"name"]];

                 [fb_friend_id addObject:[[[[result valueForKey:@"friends"]objectForKey:@"data"] objectAtIndex:i] valueForKey:@"id"]];

             }
             NSLog(@"Friends ID : %@",fb_friend_id);
             NSLog(@"Friends Name : %@",fb_friend_Name);


         }
     }];

嘗試這個 :

NSString *str = [NSString stringWithFormat:@"http://graph.facebook.com/%@/picture?type=large",friend_id];
NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:str]];
UIImage *profilePic = [UIImage imageWithData:imageData];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM