类型的价值'任何?'没有会员' valueForKey' - 斯威夫特3

时间:2016-12-24 07:34:47

标签: ios swift3 xcode8 facebook-login

我收到此错误,

  

"类型的价值'任何?'在编译时没有成员' valueForKey'",用于userName,fbID,email和fbLink。

func croppImage(originalImage:UIImage, toRect rect:CGRect) -> UIImage{

var imageRef:CGImageRef = CGImageCreateWithImageInRect(originalImage.CGImage, rect)
var croppedimage:UIImage = UIImage(CGImage:imageRef)
return croppedimage
}

1 个答案:

答案 0 :(得分:3)

您必须将Any投射到更有意义的内容,例如[String:Any]

   guard let fbData = result as? [String:Any] else { return }

   let fbid = fbData["id"]
   let email = fbData["email"]