gpt4 book ai didi

iOS App 一键闪退

转载 作者:行者123 更新时间:2023-11-28 23:54:18 31 4
gpt4 key购买 nike

我的 iOS 应用程序在我按下某个按钮后立即崩溃。只要我按下密码文本框或其他任何东西,它就会崩溃。代码如下:

import UIKit
import FirebaseDatabase

class SecondRegisterViewController: UIViewController {
var ref: DatabaseReference!

@IBOutlet weak var UsernameText: UITextField!
@IBOutlet weak var PasswordText: UITextField!
@IBOutlet weak var ConfirmText: UITextField!
@IBOutlet weak var FirstNameText: UITextField!
@IBOutlet weak var MiddleNameText: UITextField!
@IBOutlet weak var LastNameText: UITextField!
@IBOutlet weak var EmailText: UITextField!
@IBOutlet weak var NextButton: UIButton!

@IBAction func NextButton(_ sender: Any) {
ref?.child("Usernames").childByAutoId().setValue(UsernameText.text)
ref?.child("Passwords").childByAutoId().setValue(PasswordText.text)
ref?.child("First Names").childByAutoId().setValue(FirstNameText.text)
ref?.child("Last Names").childByAutoId().setValue(LastNameText.text)
ref?.child("Middle Names").childByAutoId().setValue(MiddleNameText.text)
ref?.child("Emails").childByAutoId().setValue(EmailText.text)
}

override func viewDidLoad() {
super.viewDidLoad()

ref = Database.database().reference()
NextButton.isHidden = false

if UsernameText.text?.isEmpty == false && PasswordText.text?.isEmpty == false &&
ConfirmText.text?.isEmpty == false &&
FirstNameText.text?.isEmpty == false &&
MiddleNameText.text?.isEmpty == false &&
LastNameText.text?.isEmpty == false &&
EmailText.text?.isEmpty == false{
NextButton.isHidden = false
}
}
}

它还说:

libc++abi.dylib: terminating with the uncaught exception of type NSException

这是个大问题,如果有任何帮助,我将不胜感激。

我在下面完全连接了所有 socket 和完整控制台:

2018-07-29 06:50:33.225228+0530 SchoolDrive[22497:4253058] -[SchoolDrive.SecondRegisterViewController UsernameText:]: unrecognized selector sent to instance 0x7ffc57c2e8402018-07-29 06:50:33.321943+0530 SchoolDrive[22497:4253058] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SchoolDrive.SecondRegisterViewController UsernameText:]: unrecognized selector sent to instance 0x7ffc57c2e840'*** First throw call stack:(    0   CoreFoundation                      0x00000001036381e6 __exceptionPreprocess + 294    1   libobjc.A.dylib                     0x0000000102ccd031 objc_exception_throw + 48    2   CoreFoundation                      0x00000001036b9784 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132    3   UIKit                               0x0000000103ce36db -[UIResponder doesNotRecognizeSelector:] + 295    4   CoreFoundation                      0x00000001035ba898 ___forwarding___ + 1432    5   CoreFoundation                      0x00000001035ba278 _CF_forwarding_prep_0 + 120    6   UIKit                               0x0000000103ab63e8 -[UIApplication sendAction:to:from:forEvent:] + 83    7   UIKit                               0x0000000103c317a4 -[UIControl sendAction:to:forEvent:] + 67    8   UIKit                               0x0000000103c31ac1 -[UIControl _sendActionsForEvents:withEvent:] + 450    9   UIKit                               0x00000001047ca2a0 -[UITextField _resignFirstResponder] + 155    10  UIKit                               0x0000000103ce30c8 -[UIResponder _finishResignFirstResponder] + 286    11  UIKit                               0x00000001047c9ebf -[UITextField _finishResignFirstResponder] + 48    12  UIKit                               0x0000000103ce3177 -[UIResponder resignFirstResponder] + 140    13  UIKit                               0x00000001047c9d8f -[UITextField resignFirstResponder] + 135    14  UIKit                               0x0000000103ce2df0 -[UIResponder becomeFirstResponder] + 655    15  UIKit                               0x0000000103b6cb68 -[UIView(Hierarchy) becomeFirstResponder] + 145    16  UIKit                               0x00000001047c8aff -[UITextField becomeFirstResponder] + 110    17  UIKit                               0x0000000103dbf389 -[UIKeyboardImpl handleTabWithShift:beforePublicKeyCommands:] + 384    18  UIKit                               0x0000000103db5cea -[UIKeyboardImpl handleKeyCommand:repeatOkay:beforePublicKeyCommands:] + 4884    19  UIKit                               0x0000000103dd26ce -[UIKeyboardImpl handleKeyEvent:executionContext:] + 1166    20  UIKit                               0x0000000104832bd3 -[UIKeyboardTaskEntry execute:] + 164    21  UIKit                               0x00000001048313dd -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 374    22  UIKit                               0x0000000103dd21af -[UIKeyboardImpl handleKeyEvent:] + 210    23  CoreFoundation                      0x00000001035bbccc __invoking___ + 140    24  CoreFoundation                      0x00000001035bbb84 -[NSInvocation invoke] + 308    25  UIKit                               0x00000001043f2cad -[UIRepeatedAction invoke] + 293    26  UIKit                               0x00000001043f2ce3 -[UIRepeatedAction _preInvocationTimerFire] + 22    27  UIKit                               0x0000000103ad1614 -[UIApplication _handleKeyUIEvent:] + 2050    28  UIKit                               0x0000000103ce4cdb -[UIResponder _handleKeyUIEvent:] + 79    29  UIKit                               0x0000000103ce4cdb -[UIResponder _handleKeyUIEvent:] + 79    30  UIKit                               0x0000000103ce4cdb -[UIResponder _handleKeyUIEvent:] + 79    31  UIKit                               0x0000000103ce4cdb -[UIResponder _handleKeyUIEvent:] + 79    32  UIKit                               0x0000000103ce4cdb -[UIResponder _handleKeyUIEvent:] + 79    33  UIKit                               0x0000000103ce4cdb -[UIResponder _handleKeyUIEvent:] + 79    34  UIKit                               0x0000000103ce4cdb -[UIResponder _handleKeyUIEvent:] + 79    35  UIKit                               0x0000000103ad0b3c -[UIApplication handleKeyUIEvent:] + 103    36  UIKit                               0x0000000103ad0ab5 -[UIApplication handleKeyHIDEvent:] + 692    37  UIKit                               0x0000000104410fa8 __dispatchPreprocessedEventFromEventQueue + 997    38  UIKit                               0x00000001044142c4 __handleEventQueueInternal + 5949    39  CoreFoundation                      0x00000001035dabb1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17    40  CoreFoundation                      0x00000001035bf4af __CFRunLoopDoSources0 + 271    41  CoreFoundation                      0x00000001035bea6f __CFRunLoopRun + 1263    42  CoreFoundation                      0x00000001035be30b CFRunLoopRunSpecific + 635    43  GraphicsServices                    0x000000010988ea73 GSEventRunModal + 62    44  UIKit                               0x0000000103ab5057 UIApplicationMain + 159    45  SchoolDrive                         0x0000000100fce117 main + 55    46  libdyld.dylib                       0x000000010679f955 start + 1)libc++abi.dylib: terminating with uncaught exception of type NSException

最佳答案

[SchoolDrive.SecondRegisterViewController UsernameText:]: unrecognized selector sent to instance 0x7ffc57c2e840 2018-07-29 06:50:33.321943+0530 SchoolDrive[22497:4253058] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SchoolDrive.SecondRegisterViewController UsernameText:]: unrecognized selector sent to instance 0x7ffc57c2e840'

处理布局时,无法识别的选择器通常意味着您连接 IBOutlet 的方式存在问题。在这种情况下,要么您尝试使用尚未连接的 View ,要么更可能的是,因为您说您已连接所有 socket ,所以您连接了两次/不应该连接的地方。执行其中任何一项都会导致问题。

尝试按住 ctrl 键并单击所有 View 并查看它们所连接的内容 - 您很可能会发现问题。

如果一切正常,请尝试删除所有连接并重做。如果不起作用,请回来告诉我们您已经排除了这种可能性。

编辑:由于错误消息指定了 UsernameText,这可能就是错误所在,但检查其余部分也没什么坏处。

关于iOS App 一键闪退,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51576449/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com