Facebook好友列表

时间:2012-02-03 05:38:20

标签: iphone

我正在申请我想通过登录Facebook应用程序访问用户朋友列表的应用程序。我正在使用xcode 4.2 ios 5框架。我经历了很多教程,但没有找到合适的解决方案。请帮帮我。

2 个答案:

答案 0 :(得分:1)

- (void)getFriendsResponse {
    FbGraphResponse *fb_graph_response = [fbGraph doGraphGet:@"me/friends" withGetVars:nil];// me/feed 
//parse our json
   SBJSON *parser = [[SBJSON alloc] init];
   NSDictionary *   facebook_response = [parser objectWithString:fb_graph_response.htmlResponse error:nil]; 
   //init array 
        NSMutableArray * feed = (NSMutableArray *) [facebook_response objectForKey:@"data"];
        NSMutableArray *recentFriends = [[NSMutableArray alloc] init];

        //adding values to array
        for (NSDictionary *d in feed) {

            NSLog(@"see Dicitonary :%@",d );
            facebook   = [[Facebook alloc]initWithFacebookDictionary:d ];
            [recentFriends addObject:facebook];
            NSLog(@"Postsss :->>>%@",[facebook sender]);

            [facebook release];
        }

        friends = recentFriends;

        [self.tableView reloadData];
     }

答案 1 :(得分:0)

使用facebook graph api。要获取他们的朋友列表列表,您需要read_friendlists扩展权限。 Graph Api referencepermissions