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?
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>)
来源:https://stackoverflow.com/questions/39530125/app-crashing-on-runtransitionforcurrentstate-but-no-clue-as-to-why