gpt4 book ai didi

ios - 应用程序未以模态方式呈现,但崩溃并显示 `Application tried to present modally an active controller`

转载 作者:行者123 更新时间:2023-11-28 23:33:11 26 4
gpt4 key购买 nike

我已经看了好几天了,但我不知道发生了什么。

我的崩溃每天影响 2% 的用户(跨 iPad 和 iPhone,不限于 iOS 12,底部的完整堆栈跟踪): Application tried to present modally an active controller <DownloadViewController: 0x10a0c3c00>.

在我的代码中我没有调用 UIViewController presentViewController:animated , 并且没有到 DownloadViewController 的模态转场.总有一个 UINavigationController present(这是 Storyboard的初始 VC)。

我尝试模拟竞争条件,其中 segues 执行两次,或者 UIAlertControllerUIViewController 之后显示它下面已经消失了,它试图对事件的 VC 执行 segue,但我无法重现此崩溃:我最多只能导致 DownloadViewController被推到UINavigationController两次(不是世界末日也没有崩溃)。

在我添加一些 UIAlertController 后,崩溃开始发生所以我假设他们与它有关,但我不知道如何。

知道下一步要去哪里吗?


Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x2201b0518 __exceptionPreprocess
1 libobjc.A.dylib 0x21f38b9f8 objc_exception_throw
2 UIKitCore 0x24c01859c -[UIViewController _presentViewController:withAnimationController:completion:]
3 UIKitCore 0x24c01aa7c __63-[UIViewController _presentViewController:animated:completion:]_block_invoke
4 UIKitCore 0x24c033570 -[_UIViewControllerTransitionCoordinator _applyBlocks:releaseBlocks:]
5 UIKitCore 0x24c02f930 -[_UIViewControllerTransitionContext _runAlongsideCompletions]
6 UIKitCore 0x24c02f608 -[_UIViewControllerTransitionContext completeTransition:]
7 UIKitCore 0x24ca2ba00 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:]
8 UIKitCore 0x24ca02758 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:]
9 UIKitCore 0x24ca02d2c -[UIViewAnimationState animationDidStop:finished:]
10 UIKitCore 0x24ca02dcc -[UIViewAnimationState animationDidStop:finished:]
11 QuartzCore 0x22464f958 CA::Layer::run_animation_callbacks(void*)
12 libdispatch.dylib 0x21fbf17d4 _dispatch_client_callout
13 libdispatch.dylib 0x21fb9f004 _dispatch_main_queue_callback_4CF$VARIANT$mp
14 CoreFoundation 0x220141ec0 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
15 CoreFoundation 0x22013cdf8 __CFRunLoopRun
16 CoreFoundation 0x22013c354 CFRunLoopRunSpecific
17 GraphicsServices 0x22233c79c GSEventRunModal
18 UIKitCore 0x24c5afb68 UIApplicationMain
19 WeDownload 0x100ea1f40 main (main.m:14)
20 libdyld.dylib 0x21fc028e0 start

最佳答案

解决了。问题是在这样的 block 内:

[UIView transitionWithView:self.view duration:0.2 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{

...我有效地调用了[self presentViewController:alert animated:YES completion:nil];连续两次(警报是 UIAlertController)。

最重要的学习:错误信息中Application tried to present modally an active controller <DownloadViewController: 0x10a0c3c00> , DownloadViewController 是 presenter 而不是被呈现的东西。如果我能正确理解该错误消息,我会早几天弄清楚这一点。

关于ios - 应用程序未以模态方式呈现,但崩溃并显示 `Application tried to present modally an active controller`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55774654/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com