0

I am Working on Xcode 9.2 Swift 4.0 using FacebookSDKs-iOS-20160316 for Facebook Login Authentication Integration . My storyboard is empty .

On Running

Facebook Login button is coming on an app

When clicked Facebook login page comes, after successful login

Permission for my app is asked, When allowed following page comes

Page after allowing access to my app

When I click on done button of this page

I am redirected to my storyboard , and this time also same login button is there , my login button is not changed to Logout. On clicking it again following page comes:
After clicking Login button again This is happening every Time. Please help me.

Things I have tried:

Restarted the Simulator

Restarted the Xcode

Changed Simulator

//My View Controller is having code:

class ViewController: UIViewController,FBSDKLoginButtonDelegate{

func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWithresult:     
FBSDKLoginManagerLoginResult!, error: Error!) 
 {
 print("Logged in")
 }
    func loginButtonDidLogOut(_ loginButton: FBSDKLoginButton!) 
{
    print("Logged out")
}

let loginManager: FBSDKLoginManager = FBSDKLoginManager()
override func viewDidLoad() 
  {
    super.viewDidLoad()
    let button = FBSDKLoginButton()
    button.center = self.view.center
    self.view.addSubview(button)
    button.delegate = self
  }
}

1 Answer 1

0

Try this function as for logout along with login.

func loginButtonDidLogOut(_ loginButton: FBSDKLoginButton!) {
        print("User is looged out")
    }
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.