gpt4 book ai didi

ios - 安装相同应用程序的 Facebook 好友头像

转载 作者:行者123 更新时间:2023-11-29 00:32:17 25 4
gpt4 key购买 nike

我需要显示安装相同应用程序的 Facebook 好友列表。我有使用“Facebook-Graph-API”的“FriendName”和“FriendID”。但我没有得到“FriendProfile Picture”。我正在使用这段代码:

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

关于ios - 安装相同应用程序的 Facebook 好友头像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41457514/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com