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”参数]