2016-03-29 62 views
0

我有一個展開的segue,它可以在iOS 9.3的橫向或縱向上正常工作,但是如果我在呈現目標視圖控制器(A)和視圖控制器之間旋轉設備(C)。Unwind在定位變化後發生崩潰

任何想法爲什麼發生這種情況,以及如何解決這個問題?

我的故事板的高層視圖:

enter image description here

例外:

2016-03-28 16:58:14.194 ClarityLife[96444:11508887] *** Assertion failure in -[_UIStoryboardUnwindChain initFromSourceViewController:toDestinationViewController:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.60.7/UIStoryboardUnwindSegueTemplate.m:119 
2016-03-28 16:58:14.202 ClarityLife[96444:11508887] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not unwind from <ClarityLife.VideoCallDisconnectingViewController: 0x7fdaa07c2b50> to <ClarityLife.VideoCallIdleViewController: 0x7fdaa2c13ab0> because a common ancestor could not be found. (Note that it is not supported to unwind from a view controller to one of its descendants.)' 
*** First throw call stack: 
(
    0 CoreFoundation      0x000000011128bd85 __exceptionPreprocess + 165 
    1 libobjc.A.dylib      0x0000000113f92deb objc_exception_throw + 48 
    2 CoreFoundation      0x000000011128bbea +[NSException raise:format:arguments:] + 106 
    3 Foundation       0x0000000111e93d5a -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198 
    4 UIKit        0x0000000113384c97 -[_UIStoryboardUnwindChain initFromSourceViewController:toDestinationViewController:] + 908 
    5 UIKit        0x0000000113385e49 -[UIStoryboardUnwindSegueTemplate newDefaultPerformHandlerForSegue:] + 125 
    6 UIKit        0x000000011315e395 -[UIStoryboardSegueTemplate segueWithDestinationViewController:] + 431 
    7 UIKit        0x00000001133865b7 -[UIStoryboardUnwindSegueTemplate segueWithDestinationViewController:] + 631 
    8 UIKit        0x00000001133868ae -[UIStoryboardUnwindSegueTemplate _performWithDestinationViewController:sender:] + 120 
    9 UIKit        0x0000000113386808 -[UIStoryboardUnwindSegueTemplate _perform:] + 86 
    10 UIKit        0x0000000112bb45f8 -[UIViewController performSegueWithIdentifier:sender:] + 99 
    11 ClarityLife       0x000000010fa6f9c5 _TFC11ClarityLife36VideoCallDisconnectingViewController13viewDidAppearfSbT_ + 261 
    12 ClarityLife       0x000000010fa6fa21 _TToFC11ClarityLife36VideoCallDisconnectingViewController13viewDidAppearfSbT_ + 49 
    13 UIKit        0x0000000112bb7335 -[UIViewController _setViewAppearState:isAnimating:] + 830 
    14 UIKit        0x0000000112bb7cb8 -[UIViewController _endAppearanceTransition:] + 262 
    15 UIKit        0x0000000112b8208a -[UIPresentationController transitionDidFinish:] + 827 
    16 UIKit        0x0000000112d5f38f -[_UICurrentContextPresentationController transitionDidFinish:] + 42 
    17 UIKit        0x0000000112b857c1 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke_2 + 183 
    18 UIKit        0x00000001134444c8 -[_UIViewControllerTransitionContext completeTransition:] + 101 
    19 UIKit        0x0000000112b7ef77 -[UITransitionView notifyDidCompleteTransition:] + 252 
    20 UIKit        0x0000000112b7ec88 -[UITransitionView _didCompleteTransition:] + 1344 
    21 UIKit        0x0000000112b813f4 -[UITransitionView _transitionDidStop:finished:] + 104 
    22 UIKit        0x0000000112aa47ff -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 241 
    23 UIKit        0x0000000112aa4bae -[UIViewAnimationState animationDidStop:finished:] + 80 
    24 QuartzCore       0x00000001128c93c8 _ZN2CA5Layer23run_animation_callbacksEPv + 308 
    25 libdispatch.dylib     0x00000001160393eb _dispatch_client_callout + 8 
    26 libdispatch.dylib     0x00000001160211ef _dispatch_main_queue_callback_4CF + 1738 
    27 CoreFoundation      0x00000001111e50f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9 
    28 CoreFoundation      0x00000001111a6b99 __CFRunLoopRun + 2073 
    29 CoreFoundation      0x00000001111a60f8 CFRunLoopRunSpecific + 488 
    30 GraphicsServices     0x0000000115ad5ad2 GSEventRunModal + 161 
    31 UIKit        0x0000000112a16f09 UIApplicationMain + 171 
    32 ClarityLife       0x000000010fa11432 main + 114 
    33 libdyld.dylib      0x000000011606d92d start + 1 
    34 ???         0x0000000000000001 0x0 + 1 

回答

1

解決。的問題是在應用程序委託方法:

func splitViewController(splitViewController: UISplitViewController, 
    collapseSecondaryViewController secondaryViewController: UIViewController, 
    ontoPrimaryViewController primaryViewController: UIViewController) -> Bool { 
    ... 
    return true 
} 

該方法失敗了返回true,這引起splitViewController塌陷目標視圖控制器(A),它是secondaryViewController,退繞之前進行。解決方案是通過返回false來確保次級未摺疊,從而確保展開的目標可用。

相關問題