App crashing on runTransitionForCurrentState but no clue as to why
Asked Answered
F

1

8

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

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

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?

Faultfinder answered 16/9, 2016 at 11:14 Comment(4)
show your relevant code that how you presenting some viewcontroller!!!Evelynneven
thanks Lion, however I'm presenting VCs from about 50 different places at least, and cannot reproduce the problem from any of them.Faultfinder
I've got this exact same crash happening and I don't know what's going on either. The only clue I have is most of the time, one of my view controllers reports a viewWillDisappear/viewDidDisappear pair twice on a row (with a several-second delay), without reporting that it appeared in between.Hurley
After investigating some more, my duplicated will/did disappear is likely a UIKit bug with custom container controllers, but it does suggest that I was ripping down a view controller stack in the action handler of a UIAlertController sheet, if that's helpful. The action handlers aren't supposed to run until the UIAlertController is fully-dismissed, but maybe there's some weird race there?Hurley
H
10

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 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.

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

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

Hurley answered 16/9, 2016 at 21:8 Comment(3)
Getting very similar crash and suspecting the reason is sameConstitution
@Kevin Ballard I have a similar issue and am trying to figure out the root cause. I added a func which handles two dismissals, I am wondering if this is safe: #48765372Ronna
@Lily Ballard is there an easy way to find this issue? I have been looking throughout my code, but I have not been able to see this log message: > transitionViewForCurrentTransition is not set, presentation controller was dismissed during the presentation? (<_UIOverCurrentContextPresentationController: 0x7faf277d9c30>) Is this more of a timing issue? In our app we have a lot of blocking spinners, when the user wants to save something, we display a blocking spinner preventing any action... Is there not any way to tell which ViewController they were last on?Bradbradan

© 2022 - 2024 — McMap. All rights reserved.