gpt4 book ai didi

swift - 快速抛出异常 - Void 不能转换为 FBSDKGraphRequestHandler?

转载 作者:行者123 更新时间:2023-11-28 09:27:21 27 4
gpt4 key购买 nike

我的代码是:

let graphRequest = FBSDKGraphRequest(graphPath: "me", 
parameters: ["fields": "id, name, gender"])

graphRequest.startWithCompletionHandler({
(connection, result, error) -> Void in
if error != nil {
print(error)

} else if let result = result {

PFUser.currentUser()?["gender"] = result["gender"]
PFUser.currentUser()?["name"] = result["name"]
try PFUser.currentUser()?.save()

let userId = result["id"] as! String

我收到以下错误:

Void is not convertible to FBSDKGraphRequestHandler!

为什么我会收到这样的错误?

最佳答案

看看是否可以使闭包的参数具体化,如下所示:

request.startWithCompletionHandler({
(connection:FBSDKGraphRequestConnection?, result:AnyObject?, error:NSError?) -> Void in

});

您应该能够将 -> Void 排除在外。

关于swift - 快速抛出异常 - Void 不能转换为 FBSDKGraphRequestHandler?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34789492/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com