Ios FBSDKGraphRequest不工作
过去几天,我一直在努力让Facebook SDK在IOS swift上运行。我可以让登录工作,但我无法获得个人资料信息。代码如下。 在这里输入代码Ios FBSDKGraphRequest不工作,ios,swift,facebook,facebook-graph-api,facebook-sdk-4.0,Ios,Swift,Facebook,Facebook Graph Api,Facebook Sdk 4.0,过去几天,我一直在努力让Facebook SDK在IOS swift上运行。我可以让登录工作,但我无法获得个人资料信息。代码如下。 在这里输入代码 func fetchProfile() { print("Inside fetchProfile()") let params = ["fields": "id, first_name, last_name, middle_name, name, email, picture"] let request = FBSDKGrap
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作为参数传递,并查看请求返回的内容。用户可能没有授予权限,或者您可能写错了权限。
我没有看到回复,所以我正在尽力帮助你。
如果不起作用,请告诉我