我正在使用X-code 9 beta Swift 4,并且可以运行和构建但是会出现以下错误并且仅加载白屏: ***由于未捕获的异常终止应用程序' NSInvalidArgumentException',原因:' - [myapp.logInVC _finishDecodingLayoutGuideConnections:]:无法识别的选择器发送到实例0x10251ead0'
不确定_finishDecodingLayoutGuideConnections是什么? 我检查了所有选择器,但没有看到问题。这是一个使用Firebase的登录屏幕,我希望如果登录成功,它将加载View Controller。 任何帮助将不胜感激!
class logInVC:UIViewController {
@IBOutlet weak var signInSelector: UISegmentedControl!
@IBOutlet weak var signInLabel: UILabel!
@IBOutlet weak var emailTextField: UITextField!
@IBOutlet weak var passwordTextField: UITextField!
var isSignIn:Bool = true
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func signInSelectorChanged(_ sender: UISegmentedControl) {
switch signInSelector.selectedSegmentIndex
{
case 0:
signInLabel.text = "sign in";
case 1:
signInLabel.text = "create account";
default:
break
}
}
@IBAction func signInButtonTapped(_ sender: UIButton) {
if isSignIn {
//validation
if let email = emailTextField.text, let pass = passwordTextField.text
{
//sign in with Firebase
Auth.auth().signIn(withEmail: email, password: pass) { (user, error) in
// make sure user isn't nil
if user != nil {
//user is found, go to AR experience
self.performSegue(withIdentifier: "goToHome" , sender: self)
}
else {
//error, check error and show message
}
}
}
else {
//register with Firebase
Auth.auth().createUser(withEmail: emailTextField.text!, password: passwordTextField.text!) { (user, error) in
// make sure user isn't nil
if user != nil {
//user is found, go to AR experience
self.performSegue(withIdentifier: "goToHome" , sender: self)
}
else {
//error, check error, and show message
}
}
答案 0 :(得分:0)
检查您的IBOutlets和IBActions是否正确连接。未正确设置XiB和Class文件时发生错误。