0

嗨,我正在尝试获取使用我的应用程序的 Facebook 朋友列表,当我尝试此功能时,我得到了空数据

我的示例代码

let request: FBSDKGraphRequest = FBSDKGraphRequest(graphPath: "me/friends", parameters: nil, HTTPMethod: "GET")

    request.startWithCompletionHandler { (connection : FBSDKGraphRequestConnection!, result : AnyObject!, error : NSError!) -> Void in
        if error == nil {
            print("Friends are : \(result)")
        } else {
            print("Error Getting Friends \(error)");
        }
    }

我的输出是

FBSDKLog: starting with Graph API v2.4, GET requests for /me/friends should  contain an explicit "fields" parameter
ID is: 964865453559288
2015-12-21 18:25:55.635[12226:218972] fb_id 964865453559288
Friends are : {
data =     (
);
}
4

1 回答 1

0

使用 user_id 来获取朋友。它工作正常。试试看

-(void)fetchFriendList:(NSString*)userid
{

    NSString *string = [NSString stringWithFormat:@"/%@/taggable_friends",userid];

    FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                                  initWithGraphPath:string
                                  parameters:nil];
    [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                          id result,
                                          NSError *error) {

    ///// your results
    }];




}
于 2015-12-21T13:33:52.297 回答