I\'m trying to get information through the facebook sdk but so far I\'m getting only the id and the name of the user, although I\'m sure there is an email available, as it i
Use these functions this will work for sure
@IBAction func fbsignup(_ sender: Any) {
let fbloginManger: FBSDKLoginManager = FBSDKLoginManager()
fbloginManger.logIn(withReadPermissions: ["email"], from:self) { (result, error) -> Void in
if(error == nil){
let fbLoginResult: FBSDKLoginManagerLoginResult = result!
if( result?.isCancelled)!{
return }
if(fbLoginResult .grantedPermissions.contains("email")){
self.getFbId()
}
} }
}
func getFbId(){
if(FBSDKAccessToken.current() != nil){
FBSDKGraphRequest(graphPath: "me", parameters: ["fields": "id,name , first_name, last_name , email"]).start(completionHandler: { (connection, result, error) in
if(error == nil){
print("result")
}
})
}
}
and connect the fbsignup(_sender: Any) function with your button