2016-01-20 73 views
0

在VC1中,一個按鈕對VC2具有觸發的繼續動作。當我點擊VC1中的按鈕時,當我嘗試調用超級應用程序時,該應用程序崩潰了對sendEvent的重寫。爲什麼我的segue在重寫的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 
+0

你想發送什麼樣的事件到VC2?你想以編程方式移動到其他VC嗎? –

+0

嗨亞倫。你可以點擊觸發問題的按鈕,然後在Xcode檢查器中檢查連接。它顯示按鈕連接到什麼? –

回答

0

我建議你點擊造成問題的按鈕,在Xcode中,單擊連接檢查。看看按鈕連接到什麼。

複製視圖控制器並在故事板中重新使用它可能會導致類似的問題。有時與其他網點的連接也會被複制,並且在運行時會導致問題。

如果想法正確,請確保刪除IBAction並寫入一個新的並將其連接到按鈕。

+0

爲了補充說明 - 很可能您看到的問題來自VC2,而不是VC1。故事板中可能存在延遲的壞點。 – shortstuffsushi

+0

@shortstuffsushi再次感謝:) –

+0

這個問題絕對是在VC2中。一個按鈕連接到一個不存在的插座。我猜我沒有得到不符合keyValue,因爲我重寫了sendEvent。 –