教程应用程序的SignUpViewController中使用的FBSDKGraphRequest连接处理程序现在已过时。我将其更新到了一个不会出错的地步,直到我尝试在用户成功注册后放置Parse代码。一旦我输入Parse代码(使用FB SDK结果对用户进行签名),我就会得到错误"表达类型不明确,没有更多的上下文"。
这是我到目前为止所拥有的:
let graphRequest = FBSDKGraphRequest(graphPath: "me", parameters: ["fields": "id, name, gender, email"])
graphRequest.startWithCompletionHandler ({ connection, result, error in
if error != nil {
//onError()
print(error)
return
} else {
let fbResult = result as! Dictionary<String, AnyObject>
print("FbResult \(fbResult)")
PFUser.currentUser()?["gender"] = result["gender"]
PFUser.currentUser()?["name"] = result["name"]
try PFUser.currentUser()?.save()
let userId = result["id"] as! String
let facebookProfilePictureUrl = "https://graph.facebook.com/" + userId + "/picture?type=large"
if let fbpicUrl = NSURL(string: facebookProfilePictureUrl) {
if let data = NSData(contentsOfURL: fbpicUrl) {
self.profilePic.image = UIImage(data: data)
let imageFile:PFFile = PFFile(data: data)!
PFUser.currentUser()?["image"] = imageFile
try PFUser.currentUser()?.save()
}
})
出于某种原因,XCode在&#34; print fbresult&#34;之后讨厌任何事情。线。这是Parse代码之前的工作代码的pastebin:
如何更新此选项以接受解析代码?
谢谢!
PS:我可以确认我有最新的Parse和FB SDK。我正在运行最新版本的XCode(7.2.1)。
答案 0 :(得分:0)
我在通过udemy swift课程时也遇到了同样的问题。
我的解决方案是:
{{1}}
希望它适合你!