如何在IOS 6中获取登录用户的朋友的朋友列表

时间:2013-01-11 06:28:45

标签: iphone objective-c ios6

在我的应用程序中,我通过使用FBFriendPickerViewController登录用户的好友列表,如果我选择该列表中的任何一个,我可以显示他的详细信息,如姓名,ID,位置等。我的问题是通过使用这些详细说明如何在我的应用程序中获取他的(在FBFriendPickerViewController中选择的朋友)朋友列表?。

1 个答案:

答案 0 :(得分:0)

试试这个:

 NSArray *accounts = [accountStore
                                   accountsWithAccountType:facebookAccountType];
              ACAccount *facebookAccount = [accounts lastObject];
              NSString *acessToken = [NSString stringWithFormat:@"%@",facebookAccount.credential.oauthToken];
              NSDictionary *parameters = @{@"access_token": acessToken};
              NSURL *feedURL = [NSURL URLWithString:@"https://graph.facebook.com/me/friends"];
              SLRequest *feedRequest = [SLRequest
                                        requestForServiceType:SLServiceTypeFacebook
                                        requestMethod:SLRequestMethodGET
                                        URL:feedURL
                                        parameters:parameters];
              feedRequest.account = facebookAccount;
              [feedRequest performRequestWithHandler:^(NSData *responseData,
                                                       NSHTTPURLResponse *urlResponse, NSError *error)
               {
                   NSLog(@"%@",[[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]);
               }];
          }
          else
          {
              // Handle Failure
          }