NSInvalidArgumentException

时间:2014-10-27 00:38:49

标签: ios login swift

我收到异常错误,无论我如何更改代码,我都会遇到同样的错误。

这是错误:

2014-10-26 18:29:16.522 UFMTest1[3494:2091624] -[UIView text]: unrecognized selector sent to instance 0x796bc4b0
2014-10-26 18:29:16.552 UFMTest1[3494:2091624] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView text]: unrecognized selector sent to instance 0x796bc4b0'
*** First throw call stack:
(
    0   CoreFoundation                      0x002b4946 __exceptionPreprocess + 182
    1   libobjc.A.dylib                     0x01c90a97 objc_exception_throw + 44
    2   CoreFoundation                      0x002bc5c5 -[NSObject(NSObject) doesNotRecognizeSelector:] + 277
    3   CoreFoundation                      0x002053e7 ___forwarding___ + 1047
    4   CoreFoundation                      0x00204fae _CF_forwarding_prep_0 + 14
    5   UFMTest1                            0x000cc377 _TFC8UFMTest114ViewController14mySubmitButtonfS0_FPSs9AnyObject_T_ + 487
    6   UFMTest1                            0x000cd6aa _TToFC8UFMTest114ViewController14mySubmitButtonfS0_FPSs9AnyObject_T_ + 58
    7   libobjc.A.dylib                     0x01ca67cd -[NSObject performSelector:withObject:withObject:] + 84
    8   UIKit                               0x00ac923d -[UIApplication sendAction:to:from:forEvent:] + 99
    9   UIKit                               0x00ac91cf -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 64
    10  UIKit                               0x00bfce86 -[UIControl sendAction:to:forEvent:] + 69
    11  UIKit                               0x00bfd2a3 -[UIControl _sendActionsForEvents:withEvent:] + 598
    12  UIKit                               0x00bfc50d -[UIControl touchesEnded:withEvent:] + 660
    13  UIKit                               0x00b1960a -[UIWindow _sendTouchesForEvent:] + 874
    14  UIKit                               0x00b1a0e5 -[UIWindow sendEvent:] + 791
    15  UIKit                               0x00adf549 -[UIApplication sendEvent:] + 242
    16  UIKit                               0x00aef37e _UIApplicationHandleEventFromQueueEvent + 20690
    17  UIKit                               0x00ac3b19 _UIApplicationHandleEventQueue + 2206
    18  CoreFoundation                      0x001d81df __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
    19  CoreFoundation                      0x001cdced __CFRunLoopDoSources0 + 253
    20  CoreFoundation                      0x001cd248 __CFRunLoopRun + 952
    21  CoreFoundation                      0x001ccbcb CFRunLoopRunSpecific + 443
    22  CoreFoundation                      0x001cc9fb CFRunLoopRunInMode + 123
    23  GraphicsServices                    0x0404824f GSEventRunModal + 192
    24  GraphicsServices                    0x0404808c GSEventRun + 104
    25  UIKit                               0x00ac78b6 UIApplicationMain + 1526
    26  UFMTest1                            0x000ceefe top_level_code + 78
    27  UFMTest1                            0x000cef3b main + 43
    28  libdyld.dylib                       0x023fdac9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

这是代码:     导入UIKit

class ViewController: UIViewController {

@IBOutlet var theTextfieldUsername: UITextField!

@IBOutlet var theTextfieldPassword: UITextField!

@IBOutlet var theLabel: UILabel!

@IBAction func mySubmitButton(sender : AnyObject)
{
var usr = "deb"
var pw  = "doit"

if theTextfieldUsername.text == usr &&
theTextfieldPassword.text == pw
{
theLabel.text = "You Did It!"
}
else
{
theLabel.text = "You Didn't Do It!"
}
}

override func viewDidLoad() 
{
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}

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


}

似乎一旦我得到一个例外,无论我做什么,它都会恢复到最后一个例外。

0 个答案:

没有答案