App crashes with "Fatal Exception: NSInvalidArgumentException"

Hey there,

we are seeing following crash in our firebase cras console:

Fatal Exception: NSInvalidArgumentException
-[_UISnapshotWindow actualSceneBounds]: unrecognized selector sent to instance 0x10ff840e0

Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0xec69c __exceptionPreprocess
1  libobjc.A.dylib                0x2bc80 objc_exception_throw
2  CoreFoundation                 0x17cfdc +[NSObject(NSObject) _copyDescription]
3  UIKitCore                      0xe31bcc -[UIResponder doesNotRecognizeSelector:]
4  CoreFoundation                 0x31e08 ___forwarding___
5  CoreFoundation                 0x172950 _CF_forwarding_prep_0
6  UIKitCore                      0x265bd8 -[UIUndoGestureInteraction didMoveToView:]
7  UIKitCore                      0xb3510 _setInteractionView
8  UIKitCore                      0xb345c -[UIView(Dragging) addInteraction:]
9  UIKitCore                      0x13d1d4 -[UIEditingOverlayViewController _addInteractions]
10 UIKitCore                      0x13c9b0 -[UIViewController _setViewAppearState:isAnimating:]
11 UIKitCore                      0x18ff90 __52-[UIViewController _setViewAppearState:isAnimating:]_block_invoke_2
12 UIKitCore                      0x18fe28 __52-[UIViewController _setViewAppearState:isAnimating:]_block_invoke
13 CoreFoundation                 0x353f4 __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__
14 CoreFoundation                 0x66670 -[__NSArrayI enumerateObjectsWithOptions:usingBlock:]
15 UIKitCore                      0x13cb10 -[UIViewController _setViewAppearState:isAnimating:]
16 UIKitCore                      0xad8f0 -[UIViewController __viewDidAppear:]
17 UIKitCore                      0x1bc624 __64-[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:]_block_invoke
18 UIKitCore                      0xadad0 -[UIViewController _executeAfterAppearanceBlock]
19 UIKitCore                      0xab35c -[_UIAfterCACommitBlock run]
20 UIKitCore                      0xab140 -[_UIAfterCACommitQueue flush]
21 UIKitCore                      0xab058 _runAfterCACommitDeferredBlocks
22 UIKitCore                      0xaade4 _cleanUpAfterCAFlushAndRunDeferredBlocks
23 UIKitCore                      0xaace0 _UIApplicationFlushCATransaction
24 UIKitCore                      0xaa7e4 _UIUpdateSequenceRun
25 UIKitCore                      0xa9ed4 schedulerStepScheduledMainSection
26 UIKitCore                      0xa9f90 runloopSourceCallback
27 CoreFoundation                 0x3712c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
28 CoreFoundation                 0x363a8 __CFRunLoopDoSource0
29 CoreFoundation                 0x34b5c __CFRunLoopDoSources0
30 CoreFoundation                 0x33898 __CFRunLoopRun
31 CoreFoundation                 0x33478 CFRunLoopRunSpecific
32 GraphicsServices               0x34f8 GSEventRunModal
33 UIKitCore                      0x22c62c -[UIApplication _run]
34 UIKitCore                      0x22bc68 UIApplicationMain
35 appname***                      0x40bc main + 3 (main.swift:3)
36 ???                            0x1c48c2dcc (Fehlt)

What we can see is, that

    public func userNotificationCenter(
        _ center: UNUserNotificationCenter,
        didReceive response: UNNotificationResponse,
        withCompletionHandler completionHandler: @escaping () -> Void
    ) { }

is being executed while the app has the state background. After entering a ViewController, the app seems to crash.

Does anybody had a similar crashlog and maybe a approach how we could solve it?

Something is causing this UI snapshot when it isn't yet in a window (which is why its in the _UISnapshotWindow in this case). It would be appreciated if you could file a bug with any information you have on reproducing this.

Hey @Rincewind,

we filled a bug a few weeks ago and didn't get any answers by now.

Do you have any ideas on how to solve this issue?

App crashes with "Fatal Exception: NSInvalidArgumentException"
 
 
Q