【发布时间】:2015-04-21 17:02:42
【问题描述】:
我最初可以运行应用程序(没有可见错误),但是当我在 ageBox 区域中输入一个数字并按下 getAge 按钮时,我收到了几个错误。
代码如下:
import UIKit
class ViewController: UIViewController {
@IBOutlet var ageBox: UITextField!
@IBAction func getAge(sender: AnyObject) {
println(ageBox.text)
}
@IBOutlet var answerLabel: UILabel!
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.
}
}
这是我得到的错误:
2015-04-21 10:36:24.183 猫年[5284:2484424] 找不到键盘 支持类型 4 的键盘 iPhone-PortraitChoco-NumberPad; 使用 2705787216_PortraitChoco_iPhone-Simple-Pad_Default
2015-04-21 10:36:25.826 Cat Years[5284:2484424] 找不到键盘 支持类型 4 的键盘 iPhone-PortraitChoco-NumberPad; 使用 2705787216_PortraitChoco_iPhone-Simple-Pad_Default
5
2015-04-21 10:36:27.067 猫年[5284:2484424] -[Cat_Years.ViewController getAgeButton:]:无法识别的选择器发送到实例 0x7fc881e287f0
2015-04-21 10:36:27.078 猫年[5284:2484424] *** 终止应用程序 由于未捕获的异常“NSInvalidArgumentException”,原因: '-[Cat_Years.ViewController getAgeButton:]: 发送了无法识别的选择器 到实例 0x7fc881e287f0'
*** 首先抛出调用栈:
(
0 CoreFoundation 0x00000001044c5c65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000106030bb7 objc_exception_throw + 45
2 核心基础 0x00000001044cd0ad -[NSObject(NSObject) 不识别选择器:] + 205
3 CoreFoundation 0x000000010442313c 转发 + 988
4 核心基础 0x0000000104422cd8 _CF_forwarding_prep_0 + 120
5 UIKit 0x0000000104d65da2 -[UIApplication sendAction:to:from:forEvent:] + 75
6 UIKit 0x0000000104e7754a -[UIControl _sendActionsForEvents:withEvent:] + 467
7 UIKit 0x0000000104e76919 -[UIControl touchesEnded:withEvent:] + 522
8 UIKit 0x0000000104db2998 -[UIWindow _sendTouchesForEvent:] + 735
9 UIKit 0x0000000104db32c2 -[UIWindow sendEvent:] + 682
10 UIKit 0x0000000104d79581 -[UIApplication sendEvent:] + 246
11 UIKit 0x0000000104d86d1c _UIApplicationHandleEventFromQueueEvent + 18265
12 UIKit 0x0000000104d615dc _UIApplicationHandleEventQueue + 2066
13 核心基础 0x00000001043f9431 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
14 核心基础 0x00000001043ef2fd __CFRunLoopDoSources0 + 269
15 核心基础 0x00000001043ee934 __CFRunLoopRun + 868
16 CoreFoundation 0x00000001043ee366 CFRunLoopRunSpecific + 470
17 图形服务 0x00000001084aca3e GSEventRunModal + 161
18 UIKit 0x0000000104d64900 UIApplicationMain + 1282
19 猫年 0x00000001042c8007 主要 + 135
20 libdyld.dylib 0x0000000106788145 开始 + 1
)
libc++abi.dylib:以未捕获的类型异常终止 NSException
有什么想法吗?
【问题讨论】:
-
如果您收到错误
SIGABRT可能意味着您的连接不正确。 (从故事板到代码)。只需查找有关解决此问题的任何问题,您就可以开始了。