一个单页应用,并且只有一个 Text Field 控件,我在 StoryBoard 中把 UIview 改成 UIControl 以后,无论在什么情况下点按空白处,应用都会直接崩溃。
ViewControler 类里面也是空的。
崩溃日志如下:
2018-01-30 17:11:58.500306+0800 LearniOSDev[49254:6680144] [MC] Lazy loading NSBundle MobileCoreServices.framework
2018-01-30 17:11:58.500578+0800 LearniOSDev[49254:6680144] [MC] Loaded MobileCoreServices.framework
2018-01-30 17:12:02.525683+0800 LearniOSDev[49254:6680144] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/flegde/Library/Developer/CoreSimulator/Devices/DF0FF0EC-862D-4A25-A187-301AA650D6B1/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2018-01-30 17:12:02.532306+0800 LearniOSDev[49254:6680144] [MC] Reading from private effective user settings.
2018-01-30 17:12:03.820409+0800 LearniOSDev[49254:6680144] -[LearniOSDev.ViewController backgrounTap:]: unrecognized selector sent to instance 0x7fe904612520
2018-01-30 17:12:03.832523+0800 LearniOSDev[49254:6680144] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[LearniOSDev.ViewController backgrounTap:]: unrecognized selector sent to instance 0x7fe904612520'
*** First throw call stack:
(
0 CoreFoundation 0x0000000107ec712b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010424ef41 objc_exception_throw + 48
2 CoreFoundation 0x0000000107f48024 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 UIKit 0x0000000104d1ef51 -[UIResponder doesNotRecognizeSelector:] + 295
4 CoreFoundation 0x0000000107e49f78 ___forwarding___ + 1432
5 CoreFoundation 0x0000000107e49958 _CF_forwarding_prep_0 + 120
6 UIKit 0x0000000104aec972 -[UIApplication sendAction:to:from:forEvent:] + 83
7 UIKit 0x0000000104c6bc3c -[UIControl sendAction:to:forEvent:] + 67
8 UIKit 0x0000000104c6bf59 -[UIControl _sendActionsForEvents:withEvent:] + 450
9 UIKit 0x0000000104c6a981 -[UIControl touchesBegan:withEvent:] + 282
10 UIKit 0x0000000104b62562 -[UIWindow _sendTouchesForEvent:] + 2130
11 UIKit 0x0000000104b63f2a -[UIWindow sendEvent:] + 4124
12 UIKit 0x0000000104b07365 -[UIApplication sendEvent:] + 352
13 UIKit 0x000000012154349d -[UIApplicationAccessibility sendEvent:] + 85
14 UIKit 0x0000000105453a1d __dispatchPreprocessedEventFromEventQueue + 2809
15 UIKit 0x0000000105456672 __handleEventQueueInternal + 5957
16 CoreFoundation 0x0000000107e6a101 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
17 CoreFoundation 0x0000000107f09f71 __CFRunLoopDoSource0 + 81
18 CoreFoundation 0x0000000107e4ea19 __CFRunLoopDoSources0 + 185
19 CoreFoundation 0x0000000107e4dfff __CFRunLoopRun + 1279
20 CoreFoundation 0x0000000107e4d889 CFRunLoopRunSpecific + 409
21 GraphicsServices 0x000000010a6539c6 GSEventRunModal + 62
22 UIKit 0x0000000104aeb5d6 UIApplicationMain + 159
23 LearniOSDev 0x000000010393ae47 main + 55
24 libdyld.dylib 0x0000000109065d81 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
1
axknightroad 2018-01-30 18:50:29 +08:00
`backgrounTap:` 方法没实现吧
|
2
SeanChense 2018-01-30 18:54:21 +08:00
应该是你没把 sb 中的点击事件跟代码连在一起吧
|
3
ech0x OP |
4
ech0x OP |
5
gmykissqiqi 2018-02-08 16:00:33 +08:00
unrecognized selector sent to instance
|
6
gmykissqiqi 2018-02-08 16:00:50 +08:00
unrecognized selector sent to instance
这里已经说得很清楚了啊 |
7
ech0x OP @gmykissqiqi 嗯嗯,谢谢
|