V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
ech0x
V2EX  ›  iDev

改为 UIControl 点击后应用直接奔溃

  •  
  •   ech0x · 2018-01-30 17:20:13 +08:00 · 6555 次点击
    这是一个创建于 2514 天前的主题,其中的信息可能已经有所发展或是发生改变。

    一个单页应用,并且只有一个 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
    
    7 条回复    2018-02-09 01:33:24 +08:00
    axknightroad
        1
    axknightroad  
       2018-01-30 18:50:29 +08:00
    `backgrounTap:` 方法没实现吧
    SeanChense
        2
    SeanChense  
       2018-01-30 18:54:21 +08:00
    应该是你没把 sb 中的点击事件跟代码连在一起吧
    ech0x
        3
    ech0x  
    OP
       2018-01-30 19:47:22 +08:00
    @SeanChense 实现了。。。。。
    @axknightroad
    ech0x
        4
    ech0x  
    OP
       2018-01-30 19:49:29 +08:00
    @axknightroad
    @SeanChense 是老方法忘了删了。。。。。😂😂😂没事了
    gmykissqiqi
        5
    gmykissqiqi  
       2018-02-08 16:00:33 +08:00
    unrecognized selector sent to instance
    gmykissqiqi
        6
    gmykissqiqi  
       2018-02-08 16:00:50 +08:00
    unrecognized selector sent to instance
    这里已经说得很清楚了啊
    ech0x
        7
    ech0x  
    OP
       2018-02-09 01:33:24 +08:00 via iPhone
    @gmykissqiqi 嗯嗯,谢谢
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5360 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 08:08 · PVG 16:08 · LAX 00:08 · JFK 03:08
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.