ios - 应用程序在 runTransitionForCurrentState 上崩溃,但不知道为什么

标签 ios objective-c uikit crash-reports uipresentationcontroller

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

我在 iTunes Connect 中看到大量关于我的应用程序因特定堆栈跟踪而崩溃的报告,但堆栈跟踪没有显示任何有用信息。

#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 上,没有任何线索可以帮助重现它。

有没有人以前经历过类似的事情并且对可能导致它的原因有一些见解/怀疑?

最佳答案

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

[self dismissViewControllerAnimated:YES completion:nil];
// call a method that ends up doing
[appRootViewController dismissViewControllerAnimated:NO completion:nil];
上面代码片段中的

self 是一个在根上以模态方式呈现的 View Controller 。 View Controller 本身也在当前上下文中以模态方式呈现了一些其他 Controller 。所以我正在做的是尝试用动画关闭那个过流上下文 Controller ,然后调用其他代码最终从没有动画的根关闭任何呈现的 View Controller 。

或者换句话说,为我刚刚启动的动画解散提供当前上下文的 View Controller 从 View 层次结构中删除,而前一个动画解散正在进行中。

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

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

关于ios - 应用程序在 runTransitionForCurrentState 上崩溃,但不知道为什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39530125/

相关文章:

objective-c - 在应用程序的两种配色方案之间切换?

swift - 如何更改紧凑型 UIDatePicker 的文本颜色

ios - 如何在IOS中实现输入文本框作为必填字段

ios - 奇怪的核心数据行为(重复条目)

ios - 在 UITableView 图像上缓慢滚动

ios - UIWebView 抛出帧加载中断错误

swift - 新的 UIDatePicker 作为 inputView

ios - UIActivityItemSource 在后台渲染图像

ios - 有没有办法覆盖 View 修饰符?

ios - 使用 Passsource.com 创建存折页面无法更改图标