Facebook批量请求单完成处理程序

时间:2016-03-11 18:49:49

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

我正在使用Facebook's Batch Request API同时执行两个单独的请求。问题是我似乎无法找到一种方法来实现它,因此请求都会在单个完成处理程序中返回,而不是单独完成。

有没有办法做到这一点?

这是我目前正在做的代码:

let requestMe = FBSDKGraphRequest(graphPath: "me",
    parameters: ["fields": "first_name, last_name, email, picture.width(1080).height(1080)"])
let requestThumbnailSizedPhoto = FBSDKGraphRequest(graphPath: "me",
    parameters: ["fields": "picture.width(100).height(100)"])
let connection = FBSDKGraphRequestConnection()

connection.addRequest(requestMe) { (connection, result, error) -> Void in
    print("RequestMe complete")
}

connection.addRequest(requestThumbnailSizedPhoto) { (connection, result, error) -> Void in
    print("RequestThumbnailSizedPhoto complete")
}

connection.start()

0 个答案:

没有答案