我正在使用FBSDK4.18.0在iOS中以Swift3语言集成Facebook登录。以下是以下代码:但是它不打印结果,包括
func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!) {
print("User Logged In")
if ((error) != nil)
{
// Process error
}
else if result.isCancelled {
// Handle cancellations
}
else {
// If you ask for multiple permissions at once, you
// should check if specific permissions missing
if result.grantedPermissions.contains("public_profile")
{
// Do work
// let strFirstName: [String: Any]? = (result.objectForKey("first_name") as? String)!
// let strLastName: String = (result.objectForKey("last_name") as? String)!
// let strPictureURL: String = (result.objectForKey("picture")?.objectForKey("data")?.objectForKey("url") as? String)!
if let dic = result as? [String: Any]
{ if let strFirstName = dic["first_name"] as? String, let strLastName = dic["last_name"] as? String
{
print("\(strFirstName) \(strLastName)")
}
}
}
}
}
它还显示“从'FBSDKLoginManagerLoginResult!进行投射!” 到不相关的类型'[String:Any]'总是会失败“的警告,如果” if dic = result as?[String:Any]“
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句