首页 > 解决方案 > iOS13 崩溃-[UIWindowScene _enumerateWindowsIncludingInternalWindows:onlyVisibleWindows:asCopy:stopped:withBlock:]?

问题描述

自 iOS 13.0 发布以来,我已经在我们的应用程序中看到了很多这种崩溃的发生:

Fatal Exception: NSRangeException
0  CoreFoundation                 0x1846cf278 __exceptionPreprocess
1  libobjc.A.dylib                0x1843f80a4 objc_exception_throw
2  Foundation                     0x184998480 -[NSConcretePointerArray dealloc]
3  UIKitCore                      0x1888da3b8 -[UIWindowScene _enumerateWindowsIncludingInternalWindows:onlyVisibleWindows:asCopy:stopped:withBlock:]
4  UIKitCore                      0x1888d9f74 -[UIWindowScene _topVisibleWindowPassingTest:]
5  UIKitCore                      0x1886fc4c4 +[UIWindow _hitTestToPoint:forEvent:windowServerHitTestWindow:]
6  UIKitCore                      0x1886fc854 -[UIWindow _targetWindowForPathIndex:atPoint:forEvent:windowServerHitTestWindow:]
7  UIKitCore                      0x18873c080 ____updateTouchesWithDigitizerEventAndDetermineIfShouldSend_block_invoke.52
8  UIKitCore                      0x18874b738 _UIEventHIDEnumerateChildren
9  UIKitCore                      0x18873f8d0 __dispatchPreprocessedEventFromEventQueue
10 UIKitCore                      0x188742dc4 __handleEventQueueInternal
11 UIKitCore                      0x18873bc38 __handleHIDEventFetcherDrain
12 CoreFoundation                 0x18464d090 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
13 CoreFoundation                 0x18464cfe8 __CFRunLoopDoSource0
14 CoreFoundation                 0x18464c780 __CFRunLoopDoSources0
15 CoreFoundation                 0x1846478cc __CFRunLoopRun
16 CoreFoundation                 0x18464716c CFRunLoopRunSpecific
17 GraphicsServices               0x18e47f328 GSEventRunModal
18 UIKitCore                      0x1886b1d0c UIApplicationMain
19 MyApp                           0x100d3ba64 main + 18 (main.swift:18)
20 libdyld.dylib                  0x1844d2424 start

它只发生在 iOS 13.0.0 (17A577)

我们没有太多关于导致这种情况的步骤的上下文,我们目前只有堆栈跟踪。

有没有其他人遇到类似的事情?

关于可能导致这种情况的任何想法?

标签: iosuikitios13

解决方案


  1. strong参考您创建的UIWindow
  2. 使用makeKeyAndVisible而不是设置window.hidden = false

推荐阅读