应用程序在 runTransitionForCurrentState 上崩溃,但不知道原因

App crashing on runTransitionForCurrentState but no clue as to why(应用程序在 runTransitionForCurrentState 上崩溃,但不知道原因)

本文介绍了应用程序在 runTransitionForCurrentState 上崩溃,但不知道原因的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试过搜索这个,但没有运气,所以希望有一些大师可能知道答案.

I've tried searching for this, but no luck, so hoping there are some guru's who may know the answer.

我在 iTunes Connect 中看到我的应用因特定堆栈跟踪而崩溃的大量报告,但堆栈跟踪显示没有任何用处.

I'm seeing loads of reports in iTunes Connect of my app crashing with a particular stack trace, but the stack trace reveals nothing useful.

#0. Crashed: main
0  UIKit                          0x1871100c0 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 324
1  UIKit                          0x1871100bc __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 320
2  UIKit                          0x1870630c8 _runAfterCACommitDeferredBlocks + 292
3  UIKit                          0x187070a80 _cleanUpAfterCAFlushAndRunDeferredBlocks + 92
4  UIKit                          0x186da25a4 _afterCACommitHandler + 96
5  CoreFoundation                 0x181c0c728 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
6  CoreFoundation                 0x181c0a4cc __CFRunLoopDoObservers + 372
7  CoreFoundation                 0x181c0a8fc __CFRunLoopRun + 928
8  CoreFoundation                 0x181b34c50 CFRunLoopRunSpecific + 384
9  GraphicsServices               0x18341c088 GSEventRunModal + 180
10 UIKit                          0x186e1a088 UIApplicationMain + 204
11 MyApp                          0x100082e6c main (main.m:19)
12 libdyld.dylib                  0x1816d28b8 start + 4

报告没有规律,发生在 iOS 9.1、9.2、9.3-10 和各种 iPhone 和 iPad 上,没有任何线索可以帮助重现.

No pattern to the reports, happens on iOS 9.1, 9.2, 9.3-10 and various iPhones and iPads and no clues to help reproduce it.

以前有没有人经历过这样的事情,并对可能导致它的原因有所了解/怀疑?

Has anyone experienced something like this before and have some insight/suspicion on what may cause it?

推荐答案

我遇到了完全相同的崩溃,我已经找到了原因.我的代码的高度简化版本看起来像

I have the exact same crash, and I've figured out the cause. A highly-reduced version of my code looks something like

[self dismissViewControllerAnimated:YES completion:nil];
// call a method that ends up doing
[appRootViewController dismissViewControllerAnimated:NO completion:nil];

上面代码片段中的

self 是一个视图控制器,它以模态方式呈现在根上.视图控制器本身也在当前上下文中模态地呈现了一些其他控制器.所以我正在做的是尝试用动画解除那个过电流上下文控制器,然后调用其他代码最终从根目录解除任何呈现的视图控制器而不用动画.

self in the above snippet is a view controller that's been presented modally over the root. The view controller itself has also presented modally over current context some other controller. So what I'm doing is trying to dismiss that over-current-context controller with animation, then calling other code that ultimately dismisses any presented view controller from the root without animation.

或者换句话说,为我刚刚启动的动画关闭提供当前上下文的视图控制器会从视图层次结构中移除,而之前的动画关闭正在进行中.

Or to put it another way, the view controller providing the current context for an animated dismiss that I just kicked off gets removed from the view hierarchy while the previous animated dismissal is in progress.

在 Xcode 中重现此内容时,它还会将以下内容记录到控制台:

When reproducing this in Xcode, it also logs the following to the console:

transitionViewForCurrentTransition 未设置,演示控制器在演示期间被关闭?(<_UIOverCurrentContextPresentationController: 0x7faf277d9c30>)

transitionViewForCurrentTransition is not set, presentation controller was dismissed during the presentation? (<_UIOverCurrentContextPresentationController: 0x7faf277d9c30>)

这篇关于应用程序在 runTransitionForCurrentState 上崩溃,但不知道原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:应用程序在 runTransitionForCurrentState 上崩溃,但不知道原因

基础教程推荐