title: App crashes when trying to login with facebook (IOS)
body: <p><strong>Description/Problem</strong></p>
  
  <p>I'm using Firebase as my database and Facebook login as my login method. I have followed the documentation on <a href="https://firebase.google.com/docs/auth/ios/facebook-login" rel="nofollow">Firebase</a> and on <a href="https://developers.facebook.com/docs/facebook-login/ios" rel="nofollow">Facebook</a>, but I ran into a problem. When I try to login I get the following error message:</p>
  
  <p>"Thread 1:EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)" on the line <code>let credential = FIRFacebookAuthProvider.credential(withAccessToken: FBSDKAccessToken.current().tokenString)</code></p>
  
  <p>What I am doing wrong? The error occurs right after I have clicked on the Facebook login button.</p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>import UIKit
  import FBSDKLoginKit
  import FirebaseAuth
  
  class ViewController: UIViewController, FBSDKLoginButtonDelegate {
  
      var loginButton = FBSDKLoginButton()
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          // Optional: Place the button in the center of your view.
          self.loginButton.center = self.view.center
          self.loginButton.readPermissions = ["public_profile", "email", "user_friends"]
          self.loginButton.delegate = self
  
          self.view.addSubview(loginButton)
  
          //Create label with text and position
          let label = UILabel(frame: CGRect(x: self.view.bounds.width / 2 - 100, y: self.view.bounds.height / 2 - 100, width: 200, height: 100))
          label.text = "Drag me!"
          label.textAlignment = NSTextAlignment.center
          self.view.addSubview(label)
  
          //Gesture recognition
          let gesture = UIPanGestureRecognizer(target: self, action: #selector(wasDragged(gesture:)))
          label.addGestureRecognizer(gesture)
          label.isUserInteractionEnabled = true
  
      }
  
          // Gesture transition
      func wasDragged(gesture: UIPanGestureRecognizer) {
  
          let translation = gesture.translation(in: view) //self.view
          let label = gesture.view!
  
          label.center = CGPoint(x: self.view.bounds.width / 2 + translation.x, y: self.view.bounds.height / 2 + translation.y)
  
          let xFromCenter = label.center.x - self.view.bounds.width / 2
          let scale = min(100 / abs(xFromCenter), 1)
          var rotation = CGAffineTransform(rotationAngle: xFromCenter / 200)
          var stretchAndRotation = rotation.scaledBy(x: scale, y: scale)
  
          label.transform = stretchAndRotation
  
  
          if gesture.state == UIGestureRecognizerState.ended {
  
              if label.center.x &lt; 100 {
  
                  print("Not chosen")
  
              } else if label.center.x &gt; self.view.bounds.width - 100 {
  
                  print("Chosen")
  
              }
  
              rotation = CGAffineTransform(rotationAngle: 0)
              stretchAndRotation = rotation.scaledBy(x: 1, y: 1)
              label.transform = stretchAndRotation
              label.center = CGPoint(x: self.view.bounds.width / 2, y: self.view.bounds.height / 2)
  
          }
  
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  
      // 
      func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!) {
          print("User Logged In")
  
          let credential = FIRFacebookAuthProvider.credential(withAccessToken: FBSDKAccessToken.current().tokenString)
  
          FIRAuth.auth()?.signIn(with: credential) { (user, error) in
              print("User Logged Into Firebase App")
          }
  
      }
  
      func loginButtonDidLogOut(_ loginButton: FBSDKLoginButton!) {
          print("User Did Logout")
      }
  
  }
  </code></pre>