为什么我的segue在覆盖的sendEvent上崩溃了?

时间:2016-01-20 14:01:33

标签: ios xcode swift

在VC1中,按钮具有对VC2​​的触发segue动作。当我点击VC1中的按钮时,当我尝试调用super时,app会在sendEvent的覆盖时崩溃。

public class UIApplicationSub: UIApplication {
    // properties here

    override public func sendEvent(event: UIEvent) {
            super.sendEvent(event)
            // reset idle timer here

我不确定,但是从下面的崩溃报告中看起来我在加载VC2时遇到了keyValueCoding错误,但是新视图只是一些按钮并且没有设置出口

关于可能导致此次崩溃的任何想法?

Incident Identifier: 35C240D4-60EF-41E9-B2F4-9A288806EFEF
CrashReporter Key:   81571a82664994674b5d12cbd33bb0c911f5c23f
Hardware Model:      iPhone6,1
Version:             2.14 (8.00)
Code Type:           ARM-64 (Native)
Parent Process:      launchd [1]

Date/Time:           2016-01-20 08:53:57.57 -0500
Launch Time:         2016-01-20 08:53:41.41 -0500
OS Version:          iOS 9.2 (13C75)
Report Version:      105

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0

Filtered syslog:
None found

Last Exception Backtrace:
0   CoreFoundation                  0x18186d900 __exceptionPreprocess + 124
1   libobjc.A.dylib                 0x180edbf80 objc_exception_throw + 56
2   CoreFoundation                  0x18186d5c0 -[NSException raise] + 12
3   Foundation                      0x182167f74 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 268
4   UIKit                           0x1868cff1c -[UIViewController setValue:forKey:] + 104
5   UIKit                           0x186c187cc -[UIRuntimeOutletCollectionConnection performConnect] + 908
6   CoreFoundation                  0x1817973ac -[NSArray makeObjectsPerformSelector:] + 232
7   UIKit                           0x186a296a0 -[UINib instantiateWithOwner:options:] + 1748
8   UIKit                           0x1868d333c -[UIViewController _loadViewFromNibNamed:bundle:] + 376
9   UIKit                           0x18669c250 -[UIViewController loadView] + 176
10  UIKit                           0x18655fd6c -[UIViewController loadViewIfRequired] + 144
11  UIKit                           0x18655fcc4 -[UIViewController view] + 28
12  UIKit                           0x186e2aca0 -[_UIFullscreenPresentationController _setPresentedViewController:] + 92
13  UIKit                           0x1868b70dc -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 136
14  UIKit                           0x1868dcc24 -[UIViewController _presentViewController:withAnimationController:completion:] + 3780
15  UIKit                           0x1868df9c0 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 472
16  UIKit                           0x186659cec -[UIViewController presentViewController:animated:completion:] + 184
17  UIKit                           0x186c847e4 __74-[UIStoryboardPresentationSegueTemplate newDefaultPerformHandlerForSegue:]_block_invoke + 144
18  UIKit                           0x186c8b63c -[UIStoryboardSegueTemplate _performWithDestinationViewController:sender:] + 456
19  UIKit                           0x186c8b440 -[UIStoryboardSegueTemplate _perform:] + 92
20  UIKit                           0x186c8b708 -[UIStoryboardSegueTemplate perform:] + 160
21  UIKit                           0x186597e50 -[UIApplication sendAction:to:from:forEvent:] + 100
22  UIKit                           0x186597dcc -[UIControl sendAction:to:forEvent:] + 80
23  UIKit                           0x18657fa88 -[UIControl _sendActionsForEvents:withEvent:] + 416
24  UIKit                           0x1865976e4 -[UIControl touchesEnded:withEvent:] + 572
25  UIKit                           0x186597314 -[UIWindow _sendTouchesForEvent:] + 804
26  UIKit                           0x18658fe30 -[UIWindow sendEvent:] + 784
27  UIKit                           0x1865604cc -[UIApplication sendEvent:] + 248
28  DigitalLife                     0x100899420 UIApplicationSub.sendEvent(UIEvent) -> () (UIApplicationSub.swift:50)
29  DigitalLife                     0x10089999c @objc UIApplicationSub.sendEvent(UIEvent) -> () (UIApplicationSub.swift:0)
30  UIKit                           0x18655e794 _UIApplicationHandleEventQueue + 5528
31  CoreFoundation                  0x181824efc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
32  CoreFoundation                  0x181824990 __CFRunLoopDoSources0 + 540
33  CoreFoundation                  0x181822690 __CFRunLoopRun + 724
34  CoreFoundation                  0x181751680 CFRunLoopRunSpecific + 384
35  GraphicsServices                0x182c60088 GSEventRunModal + 180
36  UIKit                           0x1865c8d90 UIApplicationMain + 204
37  DigitalLife                     0x10031f334 main (main.swift:11)
38  libdyld.dylib                   0x1812f28b8 start + 4


Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x0000000181410140 __pthread_kill + 8
1   libsystem_pthread.dylib         0x00000001814d8ef8 pthread_kill + 112
2   libsystem_c.dylib               0x0000000181381dac abort + 140
3   DigitalLife                     0x000000010095fce8 -[PLCrashReporter generateLiveReportWithThread:] + 0
4   CoreFoundation                  0x000000018186dc88 __handleUncaughtException + 652
5   libobjc.A.dylib                 0x0000000180edc23c _objc_terminate() + 112
6   libc++abi.dylib                 0x0000000180ecef44 std::__terminate(void (*)()) + 16
7   libc++abi.dylib                 0x0000000180eceb10 __cxa_rethrow + 144
8   libobjc.A.dylib                 0x0000000180edc120 objc_exception_rethrow + 44
9   CoreFoundation                  0x0000000181751728 CFRunLoopRunSpecific + 552
10  GraphicsServices                0x0000000182c60088 GSEventRunModal + 180
11  UIKit                           0x00000001865c8d90 UIApplicationMain + 204
12  DigitalLife                     0x000000010031f334 main (main.swift:11)
13  libdyld.dylib                   0x00000001812f28b8 start + 4

1 个答案:

答案 0 :(得分:0)

我建议您单击导致问题的按钮,在Xcode中,单击“连接”检查器。查看按钮的连接位置。

复制视图控制器并在故事板中重复使用可能会导致类似问题。有时,与其他插座的连接也会被复制,并且在运行时会导致问题。

如果想法正确,请务必删除IBAction并写一个新的并将其连接到按钮。