Unwind Segue中的PopViewController

时间:2015-09-15 08:21:51

标签: ios uinavigationcontroller unwind-segue

我有一个像波纹管一样的导航。

- initial - >导航控制器 - root - > firstViewController - push - > secondViewController - modal - >导航控制器 - root - > thirdViewController。

enter image description here

我正试图从thirdViewController放松到SecondViewController。然后在某些情况下的展开函数中,弹出To FirstViewController。

@IBAction func  unwind (segue:UIStoryboardSegue){
    self.navigationController?.popViewControllerAnimated(false)
}

但它已经崩溃了。

我可以通过在运行时查找导航控制器来解决问题,但它不是动态解决方案。我试图理解放松逻辑。

我是否错过了解开segue或某些事情?

2015-09-15 11:01:42.439 Test[65578:1323530] *** Assertion failure in -[UINavigationController popToViewController:transition:], /SourceCache/UIKit_Sim/UIKit-3347.44.2/UINavigationController.m:5652
2015-09-15 11:01:42.443 Test[65578:1323530] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Failed to get popped view controller.'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000101daec65 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000103919bb7 objc_exception_throw + 45
    2   CoreFoundation                      0x0000000101daeaca +[NSException raise:format:arguments:] + 106
    3   Foundation                          0x000000010224b98f -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
    4   UIKit                               0x00000001027b3951 __57-[UINavigationController popToViewController:transition:]_block_invoke + 924
    5   UIKit                               0x0000000102789188 +[UIViewController _performWithoutDeferringTransitions:] + 101
    6   UIKit                               0x00000001027b3511 -[UINavigationController popToViewController:transition:] + 616
    7   UIKit                               0x00000001027aa82b __90-[UINavigationController segueForUnwindingToViewController:fromViewController:identifier:]_block_invoke + 102
    8   UIKit                               0x000000010264ed62 -[UIApplication sendAction:to:from:forEvent:] + 75
    9   UIKit                               0x000000010264ed62 -[UIApplication sendAction:to:from:forEvent:] + 75
    10  UIKit                               0x000000010276050a -[UIControl _sendActionsForEvents:withEvent:] + 467
    11  UIKit                               0x000000010275f8d9 -[UIControl touchesEnded:withEvent:] + 522
    12  UIKit                               0x000000010269b958 -[UIWindow _sendTouchesForEvent:] + 735
    13  UIKit                               0x000000010269c282 -[UIWindow sendEvent:] + 682
    14  UIKit                               0x0000000102662541 -[UIApplication sendEvent:] + 246
    15  UIKit                               0x000000010266fcdc _UIApplicationHandleEventFromQueueEvent + 18265
    16  UIKit                               0x000000010264a59c _UIApplicationHandleEventQueue + 2066
    17  CoreFoundation                      0x0000000101ce2431 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    18  CoreFoundation                      0x0000000101cd82fd __CFRunLoopDoSources0 + 269
    19  CoreFoundation                      0x0000000101cd7934 __CFRunLoopRun + 868
    20  CoreFoundation                      0x0000000101cd7366 CFRunLoopRunSpecific + 470
    21  GraphicsServices                    0x0000000105d82a3e GSEventRunModal + 161
    22  UIKit                               0x000000010264d8c0 UIApplicationMain + 1282
    23  Test                                0x0000000101bc7487 main + 135
    24  libdyld.dylib                       0x000000010404f145 start + 1
)

0 个答案:

没有答案