Facebook GET请求 - 应包含/ me / friends的“fields”参数

时间:2015-11-02 10:06:01

标签: ios facebook swift facebook-graph-api swift2

  func getFbFriendsAndSendToServer() {
        let request = FBSDKGraphRequest(graphPath:"/me/friends", parameters: ["fields": "id, name, email"]);
        request.startWithCompletionHandler { (connection : FBSDKGraphRequestConnection!, result : AnyObject!, error : NSError!) -> Void in
            if error == nil {

            //Save friends ID
            let fbFriendsData : NSArray = result["data"] as! NSArray
            for fbData in fbFriendsData {
                self.friendsFbIDs.addObject(fbData["id"] as! String);
            }

            //send friends FB IDs to remote server
            self.sendFriendsIDsOnServer()
        }
        else {
            self.showAlertViewWithRetryButton("PullCar", message: "Unable to get your Facebook friends. Please check your internet connection and try again.", tag: 102)
        }
    }
}

这段代码不会给我如下错误。

  

- [Facebook Graph API GET请求 - 应包含“fields”参数]

0 个答案:

没有答案