检索Facebook好友列表 [英] Retrieve Facebook friends list
本文介绍了检索Facebook好友列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从Facebook检索用户的朋友列表。任何示例代码将非常感谢。
I want to retrieve the user's friends list from Facebook. Any sample code will be highly appreciated.
推荐答案
,执行 -
[facebook requestWithGraphPath:@me / friendsandDelegate:self];
//在这个委托方法中应该解析朋友的数据。
after login, do this- [facebook requestWithGraphPath:@"me/friends" andDelegate:self]; //the friends data should be parsed in this delegate method.
- (void)request:(FBRequest *)request didLoad:(id)result {
if([result isKindOfClass:[NSDictionary class]])
{
NSLog(@"dictionary");
result=[result objectForKey:@"data"];
if ([result isKindOfClass:[NSArray class]])
for(int i=0;i<[result count];i++){
NSDictionary *result2=[result objectAtIndex:i];
NSString *result1=[result2 objectForKey:@"id"]; NSLog(@"uid:%@",result1);
[uids addObject:result1];
}
}
}
朋友uids到数组。
here, i added all the friends uids to an array. same way u can get names and perform any using GraphApi .
希望它帮助了..
这篇关于检索Facebook好友列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文