簡體   English   中英

方向更改后在Unwind Segue上崩潰

[英]crash on Unwind Segue after orientation change

我有一個放開序列,可以在iOS 9.3的橫向或縱向模式下正常工作,但是如果在呈現目標視圖控制器(A)和執行放開(C)的視圖控制器之間旋轉設備,則會引發以下異常。

任何想法為什么會發生這種情況,以及如何解決此問題?

我的故事板的高級視圖:

在此處輸入圖片說明

例外:

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

解決。 問題出在應用程序委托方法中:

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

此方法失敗,返回true,這導致splitViewController在展開之前折疊了目標視圖控制器(A),即secondaryViewController。 解決方案是通過返回false來確保次級節點不會折疊,從而確保展開目標可用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM