0

我在故事板中连接了许多 segue 中的一个。我终于受够了,将一个空的 UIViewController 拖到我的故事板上,并通过 push segue 将一个按钮连接到它。没有附加到所述按钮或视图的方法、委托、操作,但我无法进行转换。

这是堆栈:

2013-10-22 13:11:10.070 Party Prioritizer[5445:a0b] -[UIViewController setDelegate:]: unrecognized selector sent to instance 0xa260020
2013-10-22 13:11:10.073 Party Prioritizer[5445:a0b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController setDelegate:]: unrecognized selector sent to instance 0xa260020'
*** First throw call stack:
(
    0   CoreFoundation                      0x01a7c5e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x0177d8b6 objc_exception_throw + 44
    2   CoreFoundation                      0x01b19903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
    3   CoreFoundation                      0x01a6c90b ___forwarding___ + 1019
    4   CoreFoundation                      0x01a6c4ee _CF_forwarding_prep_0 + 14
    5   Party Prioritizer                   0x0002f81c -[WeddingViewController prepareForSegue:sender:] + 236
    6   UIKit                               0x00a239cc -[UIStoryboardSegueTemplate _perform:] + 156
    7   UIKit                               0x00a23a59 -[UIStoryboardSegueTemplate perform:] + 115
    8   libobjc.A.dylib                     0x0178f874 -[NSObject performSelector:withObject:withObject:] + 77
    9   UIKit                               0x004f1c8c -[UIApplication sendAction:to:from:forEvent:] + 108
    10  UIKit                               0x004f1c18 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
    11  UIKit                               0x005e96d9 -[UIControl sendAction:to:forEvent:] + 66
    12  UIKit                               0x005e9a9c -[UIControl _sendActionsForEvents:withEvent:] + 577
    13  UIKit                               0x005e8d4b -[UIControl touchesEnded:withEvent:] + 641
    14  UIKit                               0x0052f0cd -[UIWindow _sendTouchesForEvent:] + 852
    15  UIKit                               0x0052fd34 -[UIWindow sendEvent:] + 1232
    16  UIKit                               0x00503a36 -[UIApplication sendEvent:] + 242
    17  UIKit                               0x004edd9f _UIApplicationHandleEventQueue + 11421
    18  CoreFoundation                      0x01a058af __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
    19  CoreFoundation                      0x01a0523b __CFRunLoopDoSources0 + 235
    20  CoreFoundation                      0x01a2230e __CFRunLoopRun + 910
    21  CoreFoundation                      0x01a21b33 CFRunLoopRunSpecific + 467
    22  CoreFoundation                      0x01a2194b CFRunLoopRunInMode + 123
    23  GraphicsServices                    0x031899d7 GSEventRunModal + 192
    24  GraphicsServices                    0x031897fe GSEventRun + 104
    25  UIKit                               0x004f094b UIApplicationMain + 1225
    26  Party Prioritizer                   0x0001c46d main + 141
    27  libdyld.dylib                       0x02e79725 start + 0
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

知道为什么我的其他 50 个 segue 的工作,但由于某种原因我不能让这个空白工作吗?

4

2 回答 2

1

带有 () 按钮的视图控制器WeddingViewController正在实现prepareForSegue:sender:。可能在这种方法中,您没有检查 segue 标识符。无论如何,在该方法的某个时刻,您正在设置没有委托的视图控制器的委托,这会导致您的崩溃。

于 2013-10-22T18:04:02.230 回答
0

您不能推送到 ViewController...您应该将其嵌入 NavigationController 中,然后推送将起作用。

于 2014-08-21T02:13:02.623 回答