简体   繁体   English

获取登录用户的Facebook朋友列表

[英]Fetch Facebook friends list of logged user

I am trying to fetch facebook friend of logged user in my iphone app. 我正在尝试在我的iPhone应用程序中获取已登录用户的Facebook朋友。 i use Facebook sdk v2.2. 我使用Facebook SDK v2.2。 facebook code return only one friend detail.but in the my facebook acccount 11 friends. facebook代码仅返回一个朋友详细信息。但是在我的facebook帐户中有11个朋友。 i used xcode 5.1 and my development target 7.1 我使用xcode 5.1和我的开发目标7.1

here is my code. 这是我的代码。

[FBRequestConnection startWithGraphPath:@"/me/friends"
                             parameters:nil
                             HTTPMethod:@"GET"
                      completionHandler:^(
                                          FBRequestConnection *connection,
                                          id result,
                                          NSError *error
                                          ) {
                          /* handle the result */

                          NSLog(@"friend list = %@",result);
                          NSArray* friends = [result objectForKey:@"data"];
                          NSLog(@"friends = %@",friends);


                      }];

Please suggest to me where am i wrong. 请向我建议我错了。 Thank you for give your precious time for suggestion. 多谢您宝贵的时间提出建议。

You are experiencing the correct behaviour. 您正在经历正确的行为。 From the v2 of the Graph API, you can only get the list of friends who authorized your app already. 从Graph API的v2版本中,您只能获得已经为您的应用授权的朋友列表。 In your case, it looks like only one of your friends used your app. 就您而言,似乎只有一个朋友使用了您的应用程序。


API Reference /{user-id}/friends API参考/{user-id}/friends

This will only return any friends who have used (via Facebook Login) the app making the request. 这只会返回使用(通过Facebook登录)使用发出请求的应用程序的所有朋友。

Source: https://developers.facebook.com/docs/graph-api/reference/v2.2/user/friends 来源: https//developers.facebook.com/docs/graph-api/reference/v2.2/user/friends

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM