Crash on viewDidMoveToWindow:shouldAppearOrDisappear

Hi, we are having unprecedented amount of crashes on ios 16.x.x

We suspect it happens when users change activity or start watching an interstitial ad. Changing activity may cause the problem but unfortunately we couldn't reproduce it.

Stack trace:

Crashed: com.apple.main-thread
0  libsystem_kernel.dylib         0x12b44 __abort_with_payload + 8
1  libsystem_kernel.dylib         0x34bf0 abort_with_payload_wrapper_internal + 104
2  libsystem_kernel.dylib         0x34b88 abort_with_payload_wrapper_internal + 30
3  libobjc.A.dylib                0x33a5c _objc_fatalv(unsigned long long, unsigned long long, char const*, char*) + 116
4  libobjc.A.dylib                0x339e8 _objc_fatalv(unsigned long long, unsigned long long, char const*, char*) + 30
5  libobjc.A.dylib                0x6c24 weak_register_no_lock + 392
6  libobjc.A.dylib                0xc5b0 objc_initWeak + 436
7  UIKitCore                      0x17528c -[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:] + 1436
8  UIKitCore                      0x1d42c -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1232
9  UIKitCore                      0xd357c __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 112
10 UIKitCore                      0x103aa04 -[UIView _postMovedFromSuperview:] + 652
11 UIKitCore                      0x8ffc4 __UIViewWasRemovedFromSuperview + 136
12 UIKitCore                      0x8cda0 -[UIView(Hierarchy) removeFromSuperview] + 264
13 libdispatch.dylib              0x24b4 _dispatch_call_block_and_release + 32
14 libdispatch.dylib              0x3fdc _dispatch_client_callout + 20
15 libdispatch.dylib              0x127f4 _dispatch_main_queue_drain + 928
16 libdispatch.dylib              0x12444 _dispatch_main_queue_callback_4CF + 44
17 CoreFoundation                 0x9a6d8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
18 CoreFoundation                 0x7c03c __CFRunLoopRun + 2036
19 CoreFoundation                 0x80ec0 CFRunLoopRunSpecific + 612
20 GraphicsServices               0x1368 GSEventRunModal + 164
21 UIKitCore                      0x3a186c -[UIApplication _run] + 888
22 UIKitCore                      0x3a14d0 UIApplicationMain + 340
23 UnityFramework                 0x170e8 -[UnityFramework runUIApplicationMainWithArgc:argv:] + 96 (main.mm:96)
24 Unity Project                      0x7c00 main + 28 (main.mm:28)
25 ???                            0x1f595a960 (Missing)

Any information would be helpful. Thanks in advance.

I think the view controller referenced here is being or has been deallocated at the time its view is being removed from the view hierarchy. Weak references can't be formed against deallocating objects, so the Obj-C runtime asserts when this happens.

Crash on viewDidMoveToWindow:shouldAppearOrDisappear
 
 
Q