gpt4 book ai didi

ios - FBSDKGraphRequest 不工作

转载 作者:行者123 更新时间:2023-11-30 12:27:44 26 4
gpt4 key购买 nike

最近几天我一直在尝试让 Facebook SDK 在 IOS swift 上运行。我可以正常登录,但无法获取个人资料信息。代码如下。 在此输入代码

func fetchProfile()
{
print("Inside fetchProfile()")
let params = ["fields": "id, first_name, last_name, middle_name, name, email, picture"]
let request = FBSDKGraphRequest(graphPath: "me", parameters: params)!
print("before fetch")

request.start(completionHandler: { (connection, result, error) -> Void in
if ((error) != nil)
{
// Process error
print("Error: \(String(describing: error))")
}
else
{
print(result)

}
}
)
}

我调试了代码,我看到函数 request.start() 被调用并立即返回,没有打印任何内容。没有错误,但没有输出。不知道发生了什么。我浏览网络寻找解决方案,但无济于事。

我的 AppDeligate 有此代码

enter code here
func application(application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(application, open: url as URL!, sourceApplication: sourceApplication, annotation: annotation)
}

任何帮助将不胜感激。

最佳答案

let request = FBSDKGraphRequest(graphPath: "me", parameters: nil)!

尝试传递 nil 作为参数并查看请求返回的内容。用户可能没有授予权限或者您可能写错了。我没有看到任何回复,所以我正在尽力帮助您。如果不起作用请告诉我。

关于ios - FBSDKGraphRequest 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43968345/

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