facebook graph request using swift 5
I got the same behavior. I am not that experienced in Swift and the Facebook Graph API and I'm not sure if it is a good solution but, currently (until I find a better solution), for me works:
connection.add(GraphRequest(graphPath: "/me", parameters: ["fields":"email"])) { httpResponse, result, error in
if error != nil {
NSLog(error.debugDescription)
return
}
// Handle vars
if let result = result as? [String:String],
let email: String = result["email"],
let fbId: String = result["id"] {
// internal usage of the email
self.userService.loginWithFacebookMail(facebookMail: email)
}
}