Ios Swift、facebook登录&;火基认证

Ios Swift、facebook登录&;火基认证,ios,swift,firebase,firebase-authentication,facebook-login,Ios,Swift,Firebase,Firebase Authentication,Facebook Login,所以我已经完成了Facebook开发者的所有步骤,也遵循了firebase的步骤 现在,在上面的代码中,我被转移到Facebook,并可以登录,但当我回到应用程序时,我仍然在loginviewcontroller中,不会被发送到下一个viewController。如果我试图取消上面图片中的代码注释,当我登录Facebook后试图返回应用程序时,一切都会崩溃。这就是我收到这个错误信息的时候 2017-10-31 16:02:49.768994+0100愿望[1479:446286]*终止 应用程

所以我已经完成了Facebook开发者的所有步骤,也遵循了firebase的步骤

现在,在上面的代码中,我被转移到Facebook,并可以登录,但当我回到应用程序时,我仍然在loginviewcontroller中,不会被发送到下一个viewController。如果我试图取消上面图片中的代码注释,当我登录Facebook后试图返回应用程序时,一切都会崩溃。这就是我收到这个错误信息的时候

2017-10-31 16:02:49.768994+0100愿望[1479:446286]*终止 应用程序由于未捕获异常“NSInvalidArgumentException”,原因: '-[\uu NSDictionaryM gtm\u httpArgumentsString]:无法识别的选择器 已发送到实例0x1c42203c0' *第一次抛出调用堆栈:(0x182047d38 0x18155c528 0x1820551f8 0x18204d6e4 0x181f330dc 0x100568b58 0x100563910 0x100562768 0x100561860 0x10054dab4 0x10054d728 0x10054d47c 0x101be149c 0x101be145c 0x101bf0110 0x101be49a4 0x101bf1104 0x101bf8100 0x181c72fe0 0x181c72c30)libc++abi.dylib:以未捕获终止 NSException类型的异常(lldb)


我需要一些重要的帮助,我正在学习应用程序开发,我的老师甚至想不出来

你能发布你的代码即时图像吗viewDidLoad()中有什么?发布你的全部VC代码(不是在图片中)我为整个视图控制器添加了代码。如果您看到像signin signout这样的代码,我还有一个“常规”注册选项register@EllinorHeimer你设置了另一个链接器标志吗?是的,但它仍然不起作用
import UIKit
import Firebase
import FirebaseAuth
import FBSDKLoginKit
import FBSDKCoreKit

class LoginViewController: UIViewController, UITextFieldDelegate, FBSDKLoginButtonDelegate {

func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!) {
    if let error = error {
        print(error.localizedDescription)
        return
    }


    /*
    let credential = FacebookAuthProvider.credential(withAccessToken: FBSDKAccessToken.current().tokenString)

    Auth.auth().signIn(with: credential) { (user, error) in
        /*
        if let error = error {
            // ...
            return
        }
        // User is signed in
        // ...
        print("Login facebook ok")
        self.dismiss(animated: true, completion: nil)
         */
    }
     */
}

func loginButtonDidLogOut(_ loginButton: FBSDKLoginButton!) {
    do {
        try Auth.auth().signOut()
    } catch {
        print ("Logout fel")
    }
}


@IBOutlet weak var epostTextField: UITextField!
@IBOutlet weak var passwordTextField: UITextField!
@IBOutlet weak var forgotPassword: UIButton!
@IBOutlet weak var registrera: UIButton!
@IBOutlet weak var loggaIn: UIButton!

func textFieldShouldReturn(_ textField: UITextField) -> Bool {
    if textField == epostTextField{
        passwordTextField.becomeFirstResponder()

    }else{
        passwordTextField.resignFirstResponder()
    }
    return true
}

override func viewDidLoad() {
    super.viewDidLoad()

    let loginButton = FBSDKLoginButton()
    loginButton.delegate = self
    view.addSubview(loginButton)

    loginButton.frame = CGRect(x: 16, y: 300, width: view.frame.width - 32, height: 50)

    self.epostTextField.delegate = self
    self.passwordTextField.delegate = self

    let tap = UITapGestureRecognizer(target: self, action: #selector(hideKeyBoard))
    self.view.addGestureRecognizer(tap)

    // Do any additional setup after loading the view.

    epostTextField.font = UIFont(name:"BebasNeue", size: 20)
    passwordTextField.font = UIFont(name:"BebasNeue", size: 20)
    forgotPassword.titleLabel?.font = UIFont (name: "BebasNeue", size: 20)
    registrera.titleLabel?.font = UIFont (name: "BebasNeue", size: 20)
    loggaIn.titleLabel?.font = UIFont (name: "BebasNeue", size: 20)

}


@objc func hideKeyBoard(sender: UITapGestureRecognizer? = nil){
    view.endEditing(true)
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}


@IBAction func loggaIn(_ sender: Any) {
    Auth.auth().signIn(withEmail: epostTextField.text!, password:
    passwordTextField.text!){


        (user, error) in

        if(error != nil)
        {

            let alert = UIAlertController(title: "Fel vid inloggning", message: "Felaktig e-post eller lösenord", preferredStyle: UIAlertControllerStyle.alert)
            alert.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.default, handler: nil))
            self.present(alert, animated: true, completion: nil)


            print("Fel vid Login")
        } else {
            print("Login ok")
            self.dismiss(animated: true, completion: nil)

        }

    }


}

@IBAction func registrera(_ sender: Any) {
    Auth.auth().createUser(withEmail: epostTextField.text!, password:
    passwordTextField.text!) {
        (user, error) in

        if(error != nil)
        {

            print("Fel vid registrering")
        } else {
            print("Registrering ok")
            self.dismiss(animated: true, completion: nil)
        }
    }

}


@IBAction func forgotPassword(_ sender: Any) {
    let alert = UIAlertController(title: "Information", message: "Nytt lösenord skickat", preferredStyle: UIAlertControllerStyle.alert)
    alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
    self.present(alert, animated: true, completion: nil)
}
`Im using Swift 4 and Xcode 9.