崩溃:_finishDecodingLayoutGuideConnections:] 无法识别的选择器发送到实例

Posted

技术标签:

【中文标题】崩溃:_finishDecodingLayoutGuideConnections:] 无法识别的选择器发送到实例【英文标题】:crashing: _finishDecodingLayoutGuideConnections:] unrecognized selector sent to instance 【发布时间】:2017-09-18 02:35:12 【问题描述】:

我正在使用 X-code 9 beta Swift 4,可以运行和构建,但出现以下错误,并且只加载白屏: *** 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[myapp.logInVC _finishDecodingLayoutGuideConnections:]:无法识别的选择器发送到实例 0x10251ead0”

不确定 _finishDecodingLayoutGuideConnections 是什么? 我检查了所有选择器,但没有发现问题。这是一个使用 Firebase 的登录屏幕,我希望如果登录成功,它将加载视图控制器。 任何帮助将不胜感激!

类 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
                
            

【问题讨论】:

【参考方案1】:

检查您的 IBOutlets 和 IBActions 是否正确连接。当您的 XiB 和 Class 文件设置不正确时,会发生该错误。

【讨论】:

以上是关于崩溃:_finishDecodingLayoutGuideConnections:] 无法识别的选择器发送到实例的主要内容,如果未能解决你的问题,请参考以下文章

为啥我的应用程序使用 __autoreleasing + __strong 会崩溃?

_CFAutoreleasePoolPop 崩溃

表视图崩溃与'*** - [__NSArrayM insertObject:atIndex:]:对象不能为零'

集合 <__NSCFString:> 在被枚举崩溃时发生了变异

UIKitCore 崩溃:_UIAnalyticsGatherMultitouchAnalytics

XCUITesting 不断使我的应用程序崩溃