[_UISnapshotWindow actualSceneBounds]: unrecognized selector

Hi everyone,


Anyone else seeing crashes like this:


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


Seems to be happening in low memory situations.


Any easy fix? Our app isn't using a huge amount of RAM.


Thanks

We've also just started seeing this crash in our app in the last week... the app seems to crash within a few seconds of starting up and usually after being backgrounded/foregrounded. Both crashes were on iPhone X devices running 12.0.1 or 12.1. Haven't been able to reproduce and there isn't a lot of references to the UISnapshotWindow class but probably related to the device capturing a screen shot of the app state when going into the background (if I had to guess).


The crash is being captured by BuddyBuild crash reporting but not the AppStore crash reporting.


Application Specific Information:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_UISnapshotWindow actualSceneBounds]: unrecognized selector sent to instance 0x11650f380'


Last Exception Backtrace:

0 CoreFoundation 0x000000019fc27ef8 <redacted> + 228

1 libobjc.A.dylib 0x000000019edf5a40 objc_exception_throw + 56

2 CoreFoundation 0x000000019fb3f154 <redacted> + 0

3 UIKitCore 0x00000001cca865c0 <redacted> + 280

4 CoreFoundation 0x000000019fc2d810 <redacted> + 1412

5 CoreFoundation 0x000000019fc2f4bc _CF_forwarding_prep_0 + 92

6 UIKitCore 0x00000001cc857d2c <redacted> + 620

7 UIKitCore 0x00000001cc85a108 <redacted> + 5736

8 UIKitCore 0x00000001cc86662c <redacted> + 52

9 UIKitCore 0x00000001cc85df80 <redacted> + 656

10 UIKitCore 0x00000001cc8665ec <redacted> + 80

11 UIKitCore 0x00000001cc85d8fc <redacted> + 56

12 UIKitCore 0x00000001cc8d9548 <redacted> + 144

13 UIKitCore 0x00000001cc8f5030 <redacted> + 280

14 UIKitCore 0x00000001cc8d93f4 <redacted> + 140

15 UIKitCore 0x00000001cc8d9b0c <redacted> + 168

16 UIKitCore 0x00000001cc8e7b98 <redacted> + 552

17 CoreFoundation 0x000000019fb94d14 <redacted> + 20

18 CoreFoundation 0x000000019fb94ce0 <redacted> + 64

19 CoreFoundation 0x000000019fb941d0 <redacted> + 392

20 CoreFoundation 0x000000019fb93e7c <redacted> + 96

21 CoreFoundation 0x000000019fb0c1c0 <redacted> + 1404

22 CoreFoundation 0x000000019fb93908 _CFXNotificationPost + 696

23 Foundation 0x00000001a05a2eb0 <redacted> + 68

24 UIKitCore 0x00000001cca71904 <redacted> + 232

25 UIKitCore 0x00000001cc2f8684 <redacted> + 2180

26 UIKitCore 0x00000001cc2f6334 <redacted> + 772

27 UIKitCore 0x00000001cc2f5fe0 <redacted> + 432

28 UIKitCore 0x00000001cc2fb1a0 <redacted> + 220

29 UIKitCore 0x00000001cc2fc100 _performActionsWithDelayForTransitionContext + 112

30 UIKitCore 0x00000001cc2fb058 <redacted> + 248

31 UIKitCore 0x00000001cc2ffd9c <redacted> + 368

32 UIKitCore 0x00000001cc641118 <redacted> + 468

33 FrontBoardServices 0x00000001a26585a0 <redacted> + 228

34 libdispatch.dylib 0x000000019f660484 <redacted> + 16

35 libdispatch.dylib 0x000000019f6373f0 <redacted> + 216

36 FrontBoardServices 0x00000001a2696640 <redacted> + 40

37 FrontBoardServices 0x00000001a26962cc <redacted> + 416

38 FrontBoardServices 0x00000001a26968e8 <redacted> + 56

39 CoreFoundation 0x000000019fbb65b8 <redacted> + 24

40 CoreFoundation 0x000000019fbb6538 <redacted> + 88

41 CoreFoundation 0x000000019fbb5e1c <redacted> + 176

42 CoreFoundation 0x000000019fbb0ce8 <redacted> + 1040

43 CoreFoundation 0x000000019fbb05b8 CFRunLoopRunSpecific + 436

44 GraphicsServices 0x00000001a1e24584 GSEventRunModal + 100

45 UIKitCore 0x00000001cca58bc8 UIApplicationMain + 212

46 <OUR_APP> 0x000000010044e0f0 _mh_execute_header + 24816

47 libdyld.dylib 0x000000019f670b94 <redacted> + 4

I am seeing exactly this issue on all iOS 12 devices, 100% when in background. I use state preservation/restoration. I even filed this as a bug here https://bugreport.apple.com/web/?problemID=49255115


Fatal Exception: NSInvalidArgumentException

-[_UISnapshotWindow actualSceneBounds]: unrecognized selector sent to instance


Fatal Exception: NSInvalidArgumentException

0 CoreFoundation 0x1a9200ec4 __exceptionPreprocess

1 libobjc.A.dylib 0x1a83d1a40 objc_exception_throw

2 CoreFoundation 0x1a9119c24 -[NSOrderedSet initWithSet:copyItems:]

3 UIKitCore 0x1d6544558 -[UIResponder doesNotRecognizeSelector:]

4 CoreFoundation 0x1a92067dc ___forwarding___

5 CoreFoundation 0x1a920848c _CF_forwarding_prep_0

6 UIKitCore 0x1d6317310 -[UIInputWindowController _aligningInsetsForChildInputViewController:includeSceneBounds:]

7 UIKitCore 0x1d6317d60 -[UIInputWindowController updateConstraintInsets]

8 UIKitCore 0x1d631ab34 -[UIInputWindowController hostAppSceneBoundsChanged]

9 UIKitCore 0x1d67f6068 -[UITextEffectsWindow _updateTransformLayer]

10 UIKitCore 0x1d67f6830 -[UITextEffectsWindow _willSnapshot]

11 UIKitCore 0x1d652324c -[UIApplication _beginSnapshotSessionForScene:withSnapshotBlock:]

12 UIKitCore 0x1d6524398 -[UIApplication _saveSnapshotWithName:]

13 UIKitCore 0x1d652f9ec __125-[UIApplication _updateStateRestorationArchiveForBackgroundEvent:saveState:exitIfCouldNotRestoreState:updateSnapshot:canvas:]_block_invoke.3034

14 libdispatch.dylib 0x1a8c396c8 _dispatch_call_block_and_release

15 libdispatch.dylib 0x1a8c3a484 _dispatch_client_callout

16 libdispatch.dylib 0x1a8c19b34 _dispatch_main_queue_callback_4CF$VARIANT$armv81

17 CoreFoundation 0x1a9190df4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__

18 CoreFoundation 0x1a918bcbc __CFRunLoopRun

19 CoreFoundation 0x1a918b1f0 CFRunLoopRunSpecific

20 GraphicsServices 0x1ab404584 GSEventRunModal

21 UIKitCore 0x1d6516d40 UIApplicationMain

22 Trak 0x100a938f8 main (main.m:16)

23 libdyld.dylib 0x1a8c4abb4 start

Seeing this crash often on iOS 12. Was there any response from Apple on that bugreport?

Issue still happended on iOS 13.1.3

LAST EXCEPTION BACKTRACE
CoreFoundation__exceptionPreprocess
libobjc.A.dylibobjc_exception_throw
CoreFoundation-[NSObject(NSObject) doesNotRecognizeSelector:]
UIKitCore-[UIResponder doesNotRecognizeSelector:]
CoreFoundation___forwarding___
CoreFoundation_CF_forwarding_prep_0
UIKitCore-[UIInputWindowControllerHostingItem _aligningInsetsForChildInputViewController:includeSceneBounds:]
UIKitCore-[UIInputWindowControllerHostingItem updateViewConstraints]
UIKitCore-[UIInputWindowControllerHosting updateViewConstraints]
UIKitCore-[UIInputWindowController updateViewConstraints]
UIKitCore-[UIInputWindowController setInputViewSet:]
UIKitCore-[UIInputWindowController performOperations:withAnimationStyle:]
UIKitCore-[UIInputResponderController setKeyWindowSceneInputViews:animationStyle:]
UIKitCore-[UIInputResponderController setInputViews:animationStyle:]
UIKitCore-[UIInputResponderController setInputViews:animated:]
UIKitCore-[UIInputResponderController setInputViews:]
UIKitCore-[UIInputResponderController _reloadInputViewsForKeyWindowSceneResponder:]
UIKitCore-[UIInputResponderController _reloadInputViewsForResponder:]
UIKitCore-[UIResponder(UIResponderInputViewAdditions) reloadInputViews]
UIKitCore-[UIResponder becomeFirstResponder]
UIKitCore-[UIResponder resignFirstResponder]
UIKitCore-[UITextView resignFirstResponder]
UIKitCore-[UIView(Hierarchy) _willMoveToWindow:]
UIKitCore-[UIScrollView _willMoveToWindow:]
UIKitCore_makeSubTreePerformSelector
UIKitCore_makeSubTreePerformSelector
UIKitCore_makeSubTreePerformSelector
UIKitCore_makeSubTreePerformSelector
UIKitCore__UIViewWillBeRemovedFromSuperview
UIKitCore-[UIView(Hierarchy) removeFromSuperview]
UIKitCore___moveViewToTemporaryWindow_block_invoke.206
UIKitCore_performAfterCommitUnderCoverAllowDefer
UIKitCore_UISnapshotViewRectAfterCommit
UIKitCore-[UIView resizableSnapshotViewFromRect:afterScreenUpdates:withCapInsets:]
UIKitCore+[UIKBViewTreeSnapshotter snapshotterForKeyboardView:afterScreenUpdates:]
UIKitCore-[UIInputViewAnimationControllerViewControllerContext initWithHost:startPlacement:endPlacement:transitionContext:]
UIKitCore+[UIInputViewAnimationControllerViewControllerContext contextWithHost:startPlacement:endPlacement:transitionContext:]
UIKitCore-[UIInputViewAnimationControllerViewController prepareAnimationWithHost:startPlacement:endPlacement:]
UIKitCore-[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:]
UIKitCore-[_UIRemoteKeyboards ignoreLayoutNotifications:]
UIKitCore-[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:]
UIKitCore-[UIInputWindowController setInputViewSet:]
UIKitCore-[UIInputWindowController performOperations:withAnimationStyle:]
UIKitCore-[UIInputResponderController setKeyWindowSceneInputViews:animationStyle:]
UIKitCore-[UIInputResponderController setInputViews:animationStyle:]
UIKitCore-[UIInputResponderController setInputViews:animated:]
UIKitCore-[UIInputResponderController setInputViews:]
UIKitCore-[UIInputResponderController _reloadInputViewsForKeyWindowSceneResponder:]
UIKitCore-[UIInputResponderController _reloadInputViewsForResponder:]
UIKitCore-[UIResponder(UIResponderInputViewAdditions) reloadInputViews]
UIKitCore-[UITextView becomeFirstResponder]
PegasusDriverclosure #1 () -> () in Core.ChatViewController.viewDidLoad() -> () ChatViewController.swift:36
PegasusDriverreabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () :0
libdispatch.dylib_dispatch_client_callout
libdispatch.dylib_dispatch_continuation_pop$VARIANT$armv81
libdispatch.dylib_dispatch_source_invoke$VARIANT$armv81
libdispatch.dylib_dispatch_main_queue_callback_4CF$VARIANT$armv81
CoreFoundation__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
CoreFoundation__CFRunLoopRun
CoreFoundationCFRunLoopRunSpecific
GraphicsServicesGSEventRunModal
UIKitCoreUIApplicationMain
PegasusDrivermain AppDelegate.swift:13
libdyld.dylibstart

Since iOS 13 I've seen a large number of app crashes with the error:


Crash, -[_UISnapshotWindow actualSceneBounds]: unrecognized selector sent to instance 0x10ea79be0


I wonder if it's the OS taking a snapshot of the app in it's last state for use in the App Switcher.



CoreFoundation

__exceptionPreprocess (CoreFoundation)
libobjc.A.dylib

objc_exception_throw (libobjc.A.dylib)
CoreFoundation

-[NSObject(NSObject) doesNotRecognizeSelector:] (CoreFoundation)
UIKitCore

-[UIResponder doesNotRecognizeSelector:] (UIKitCore)
CoreFoundation

___forwarding___ (CoreFoundation)
CoreFoundation

_CF_forwarding_prep_0 (CoreFoundation)
UIKitCore

-[UIUndoGestureInteraction didMoveToView:] (UIKitCore)
UIKitCore

_setInteractionView (UIKitCore)
UIKitCore

-[UIView(Dragging) addInteraction:] (UIKitCore)
UIKitCore

-[UIEditingOverlayViewController _addInteractions] (UIKitCore)
UIKitCore

-[UIViewController _setViewAppearState:isAnimating:] (UIKitCore)
UIKitCore

__52-[UIViewController _setViewAppearState:isAnimating:]_block_invoke (UIKitCore)
CoreFoundation

__NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ (CoreFoundation)
CoreFoundation

-[__NSArrayI enumerateObjectsWithOptions:usingBlock:] (CoreFoundation)
UIKitCore

-[UIViewController _setViewAppearState:isAnimating:] (UIKitCore)
UIKitCore

__64-[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:]_block_invoke (UIKitCore)
UIKitCore

-[UIViewController _executeAfterAppearanceBlock] (UIKitCore)
UIKitCore

_runAfterCACommitDeferredBlocks (UIKitCore)
UIKitCore

_cleanUpAfterCAFlushAndRunDeferredBlocks (UIKitCore)
UIKitCore

_afterCACommitHandler (UIKitCore)
CoreFoundation

__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ (CoreFoundation)
CoreFoundation

__CFRunLoopDoObservers (CoreFoundation)
CoreFoundation

__CFRunLoopRun (CoreFoundation)
CoreFoundation

CFRunLoopRunSpecific (CoreFoundation)
GraphicsServices

GSEventRunModal (GraphicsServices)
UIKitCore

UIApplicationMain (UIKitCore)
AlertSense


AppDelegate.swift line 31 in
main (AppDelegate.swift:31)


libdyld.dylib

start (libdyld.dylib)

I filed a report for iOS 13, https://feedbackassistant.apple.com/feedback/7469181 including a reference to your radar. Hopefully, Apple gets enough duplicates.

We've got the same crash and it is hard to replicated. It happened on ios 12.4.0 device with low memory available.
Any update here?


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

Stack Trace:

Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x1f7d7a98c __exceptionPreprocess
1  libobjc.A.dylib                0x1f6f539f8 objc_exception_throw
2  CoreFoundation                 0x1f7c971c8 -[NSOrderedSet initWithSet:copyItems:]
3  UIKitCore                      0x2247fd220 -[UIResponder doesNotRecognizeSelector:]
4  CoreFoundation                 0x1f7d801d4 ___forwarding___
5  CoreFoundation                 0x1f7d81e6c _CF_forwarding_prep_0
6  UIKitCore                      0x2245dde88 -[UIInputWindowController _aligningInsetsForChildInputViewController:includeSceneBounds:]
7  UIKitCore                      0x2245e01c4 -[UIInputWindowController updateViewConstraints]
8  UIKitCore                      0x2245e2c2c -[UIInputWindowController updateForKeyplaneChangeWithContext:]
9  UIKitCore                      0x2246730f0 -[_UIRemoteKeyboards performOnControllers:]
10 UIKitCore                      0x2245db7e0 -[UIInputSetHostView _didChangeKeyplaneWithContext:]
11 UIKitCore                      0x2244f4100 -[_UIKBCompatInputView _didChangeKeyplaneWithContext:]
12 UIKitCore                      0x2245f2254 -[UIKeyboard _didChangeKeyplaneWithContext:]
13 UIKitCore                      0x22460eb24 -[UIKeyboardImpl didMoveToSuperview]
14 UIKitCore                      0x224c540a0 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke
15 Foundation                     0x1f86f59f4 -[NSISEngine withBehaviors:performModifications:]
16 UIKitCore                      0x224c53ca8 -[UIView(Hierarchy) _postMovedFromSuperview:]
17 UIKitCore                      0x224c630f8 -[UIView(Internal) _addSubview:positioned:relativeTo:]
18 UIKitCore                      0x2245efe08 -[UIKeyboard activate]
19 UIKitCore                      0x224666990 -[UIKeyboardAutomatic activate]
20 UIKitCore                      0x2245ef1dc -[UIKeyboard setFrame:]
21 UIKitCore                      0x2245f2234 -[UIKeyboard _didChangeKeyplaneWithContext:]
22 UIKitCore                      0x224666508 -[UIKeyboardAutomatic willResume:]
23 CoreFoundation                 0x1f7ceba28 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__
24 CoreFoundation                 0x1f7ceb9f4 ___CFXRegistrationPost_block_invoke
25 CoreFoundation                 0x1f7ceaee8 _CFXRegistrationPost
26 CoreFoundation                 0x1f7ceab94 ___CFXNotificationPost_block_invoke
27 CoreFoundation                 0x1f7c64474 -[_CFXNotificationRegistrar find:object:observer:enumerator:]
28 CoreFoundation                 0x1f7cea644 _CFXNotificationPost
29 Foundation                     0x1f86d36f4 -[NSNotificationCenter postNotificationName:object:userInfo:]
30 UIKitCore                      0x2247e8f80 -[UIApplication _sendWillEnterForegroundCallbacks]
31 UIKitCore                      0x224093be4 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:]
32 UIKitCore                      0x224091b64 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke
33 UIKitCore                      0x22409182c -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]
34 UIKitCore                      0x22409636c __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke
35 UIKitCore                      0x224097150 _performActionsWithDelayForTransitionContext
36 UIKitCore                      0x224096224 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]
37 UIKitCore                      0x22409af24 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:]
38 UIKitCore                      0x2243cb2b0 -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:]
39 FrontBoardServices             0x1fa6f75d8 __80-[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke_3
40 libdispatch.dylib              0x1f77b97d4 _dispatch_client_callout
41 libdispatch.dylib              0x1f77911ec _dispatch_block_invoke_direct$VARIANT$armv81
42 FrontBoardServices             0x1fa731040 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__
43 FrontBoardServices             0x1fa730cdc -[FBSSerialQueue _performNext]
44 FrontBoardServices             0x1fa731294 -[FBSSerialQueue _performNextFromRunLoopSource]
45 CoreFoundation                 0x1f7d0c728 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
46 CoreFoundation                 0x1f7d0c6a8 __CFRunLoopDoSource0
47 CoreFoundation                 0x1f7d0bf90 __CFRunLoopDoSources0
48 CoreFoundation                 0x1f7d06ecc __CFRunLoopRun
49 CoreFoundation                 0x1f7d067c0 CFRunLoopRunSpecific
50 GraphicsServices               0x1f9f0779c GSEventRunModal
51 UIKitCore                      0x2247d1c38 UIApplicationMain
52 OjO                            0x102afbf64 main + 21 (MappableObject.swift:21)
53 libdyld.dylib                  0x1f77ca8e0 start

Still seeing this in iOS 13.3.1. Anyone got any updates from their radar filings?


Fatal Exception: NSInvalidArgumentException

0 CoreFoundation 0x1a04cc96c __exceptionPreprocess

1 libobjc.A.dylib 0x1a01e5028 objc_exception_throw

2 CoreFoundation 0x1a03cadcc -[NSOrderedSet initWithSet:copyItems:]

3 UIKitCore 0x1a45fc884 -[UIResponder doesNotRecognizeSelector:]

4 CoreFoundation 0x1a04d1048 ___forwarding___

5 CoreFoundation 0x1a04d33a0 _CF_forwarding_prep_0

6 UIKitCore 0x1a43b8930 -[UIInputWindowControllerHostingItem _aligningInsetsForChildInputViewController:includeSceneBounds:]

7 UIKitCore 0x1a43bb448 -[UIInputWindowControllerHostingItem updateViewConstraints]

8 UIKitCore 0x1a43b6248 -[UIInputWindowControllerHosting updateViewConstraints]

9 UIKitCore 0x1a43aae00 -[UIInputWindowController updateViewConstraints]

10 UIKitCore 0x1a43b3710 -[UIInputWindowController setInputViewSet:]

11 UIKitCore 0x1a43ade78 -[UIInputWindowController performOperations:withAnimationStyle:]

12 UIKitCore 0x1a40c9148 -[UIInputResponderController setKeyWindowSceneInputViews:animationStyle:]

13 UIKitCore 0x1a40c8898 -[UIInputResponderController setInputViews:animationStyle:]

14 UIKitCore 0x1a40c99ac -[UIInputResponderController setInputViews:animated:]

15 UIKitCore 0x1a40c9a1c -[UIInputResponderController setInputViews:]

16 UIKitCore 0x1a40c75f8 -[UIInputResponderController _reloadInputViewsForKeyWindowSceneResponder:]

17 UIKitCore 0x1a40c6980 -[UIInputResponderController _reloadInputViewsForResponder:]

18 UIKitCore 0x1a40c68c4 -[UIInputResponderController forceReloadInputViews]

19 UIKitCore 0x1a4433c14 __43-[_UIRemoteKeyboards reloadForSnapshotting]_block_invoke

20 UIKitCore 0x1a40c4b6c +[UIInputResponderController performOnControllers:]

21 UIKitCore 0x1a4433cac -[_UIRemoteKeyboards setIsSnapshotting:]

22 UIKitCore 0x1a488d9a0 -[UITextEffectsWindow _willSnapshot]

23 UIKitCore 0x1a45d7788 -[UIApplication _beginSnapshotSessionForScene:withSnapshotBlock:]

24 UIKitCore 0x1a45d88ec -[UIApplication _saveSnapshotWithName:]

25 UIKitCore 0x1a45e3f64 __130-[UIApplication _updateStateRestorationArchiveForBackgroundEvent:saveState:exitIfCouldNotRestoreState:updateSnapshot:windowScene:]_block_invoke

26 UIKitCore 0x1a45d6fcc _runAfterCACommitDeferredBlocks

27 UIKitCore 0x1a45c65f0 _cleanUpAfterCAFlushAndRunDeferredBlocks

28 UIKitCore 0x1a45f7980 _afterCACommitHandler

29 CoreFoundation 0x1a0447524 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__

30 CoreFoundation 0x1a04421c4 __CFRunLoopDoObservers

31 CoreFoundation 0x1a0442774 __CFRunLoopRun

32 CoreFoundation 0x1a0441f40 CFRunLoopRunSpecific

33 GraphicsServices 0x1aa6d2534 GSEventRunModal

34 UIKitCore 0x1a45cd580 UIApplicationMain

35 Cue 0x104fa875c main + 22 (AppDelegate.swift:22)

36 libdyld.dylib 0x1a02c0e18 start

I am experiencing a similar issue (iOS 13.3.1):


Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x1beb2aa48 __exceptionPreprocess
1  libobjc.A.dylib                0x1be851fa4 objc_exception_throw
2  CoreFoundation                 0x1bea2ce88 +[_CFXNotificationTokenRegistration keyCallbacks]
3  Foundation                     0x1bee62654 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
4  BaseBoard                      0x1c170926c __40-[BSAction sendResponse:withCompletion:]_block_invoke
5  libdispatch.dylib              0x1be7f7184 _dispatch_client_callout
6  libdispatch.dylib              0x1be7a9c04 _dispatch_lane_barrier_sync_invoke_and_complete
7  BaseBoard                      0x1c16bd2b0 -[BSAction sendResponse:withCompletion:]
8  UIKitCore                      0x1c2737a00 -[UIHandleRemoteNotificationAction sendResponse:]
9  UIKitCore                      0x1c2bc5d80 __91-[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion:]_block_invoke_3.2685
10 UIKitCore                      0x1c2bb9c84 _runAfterCACommitDeferredBlocks
11 UIKitCore                      0x1c2ba97d4 _cleanUpAfterCAFlushAndRunDeferredBlocks
12 UIKitCore                      0x1c2bd9744 _afterCACommitHandler
13 CoreFoundation                 0x1beaa7e68 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
14 CoreFoundation                 0x1beaa2d54 __CFRunLoopDoObservers
15 CoreFoundation                 0x1beaa3320 __CFRunLoopRun
16 CoreFoundation                 0x1beaa2adc CFRunLoopRunSpecific
17 GraphicsServices               0x1c8a43328 GSEventRunModal
18 UIKitCore                      0x1c2bb063c UIApplicationMain
19 My_App                  0x10299aea4 main + 25
20 libdyld.dylib                  0x1be92c360 start

Same error, does anyone have a solution?


0 CoreFoundation 0x1a69c4164 __exceptionPreprocess + 228 (NSException.m:199)

1 libobjc.A.dylib 0x1a66d8c1c objc_exception_throw + 60 (objc-exception.mm:565)

2 CoreFoundation 0x1a68c27e0 -[NSObject(NSObject) doesNotRecognizeSelector:] + 144 (NSObject.m:144)

3 UIKitCore 0x1aab3db6c -[UIResponder doesNotRecognizeSelector:] + 304 (UIResponder.m:684)

4 CoreFoundation 0x1a69c885c ___forwarding___ + 1328 (NSForwarding.m:3520)

5 CoreFoundation 0x1a69cab60 _CF_forwarding_prep_0 + 96

6 UIKitCore 0x1aa9f4248 -[UIUndoGestureInteraction didMoveToView:] + 116 (UIUndoGestureInteraction.m:186)

7 UIKitCore 0x1aafd8780 _setInteractionView + 88 (UIView.m:16641)

8 UIKitCore 0x1aafd8654 -[UIView(Dragging) addInteraction:] + 272 (UIView.m:16670)

9 UIKitCore 0x1aad9e9b4 -[UIEditingOverlayViewController _addInteractions] + 252 (UIEditingOverlayViewController.m:79)

10 UIKitCore 0x1aa4a8880 -[UIViewController _setViewAppearState:isAnimating:] + 876 (UIViewController.m:4735)

11 UIKitCore 0x1aa4a8ca4 __52-[UIViewController _setViewAppearState:isAnimating:]_block_invoke + 272 (UIViewController.m:4798)

12 CoreFoundation 0x1a69964e0 __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ + 24 (NSArrayHelpers.m:9)

13 CoreFoundation 0x1a6894ad8 -[__NSArrayI enumerateObjectsWithOptions:usingBlock:] + 156 (NSArrayI.m:108)

14 UIKitCore 0x1aa4a8a38 -[UIViewController _setViewAppearState:isAnimating:] + 1316 (UIViewController.m:4776)

15 UIKitCore 0x1aa4aabbc __64-[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:]_block_invoke + 48 (UIViewController.m:5316)

16 UIKitCore 0x1aa4a9920 -[UIViewController _executeAfterAppearanceBlock] + 96 (UIViewController.m:5094)

17 UIKitCore 0x1aab17d1c _runAfterCACommitDeferredBlocks + 592 (UIApplication.m:3091)

18 UIKitCore 0x1aab0713c _cleanUpAfterCAFlushAndRunDeferredBlocks + 236 (UIApplication.m:3060)

19 UIKitCore 0x1aab3888c _afterCACommitHandler + 80 (UIApplication.m:3112)

20 CoreFoundation 0x1a693ec54 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36 (CFRunLoop.c:1758)

21 CoreFoundation 0x1a69398e4 __CFRunLoopDoObservers + 420 (CFRunLoop.c:1868)

22 CoreFoundation 0x1a6939d84 __CFRunLoopRun + 1020 (CFRunLoop.c:2910)

23 CoreFoundation 0x1a6939660 CFRunLoopRunSpecific + 480 (CFRunLoop.c:3192)

24 GraphicsServices 0x1b0d4a604 GSEventRunModal + 164 (GSEvent.c:2246)

25 UIKitCore 0x1aab0e15c UIApplicationMain + 1944 (UIApplication.m:4820)

26 ******* 0x100a9dae4 main + 88 (main.m:14)

27 libdyld.dylib 0x1a67b51ec start + 4

This has become our most common crash so I'm trying a workaround. My stack traces look similar and always seemed related to updating the snapshot of the keyboard due to a background fetch event. My intended solution is to resign first responder when going in to the background and restore it when coming back. I've never been able to reproduce the crash directly myself but I'll leave an update here in a couple weeks if that fixes it.

One relatively unique thing about our app is we throw up a privacy cover when transitioning to the background to avoid showing private information on the switcher. Is anyone else who's seeing this crash doing that? Ideally we could disable the screenshot-updating behavior altogether, because the static view isn't ever going to look any different, but I don't see a way to do that.

Code Block
Fatal Exception: NSInvalidArgumentException
-[_UISnapshotWindow actualSceneBounds]: unrecognized selector sent to instance 0x10bde7db0
0 CoreFoundation 0x194fcf180 exceptionPreprocess
1 libobjc.A.dylib 0x1941a79f8 objc_exception_throw
2 CoreFoundation 0x194eeb9bc -[NSOrderedSet initWithSet:copyItems:]
3 UIKitCore 0x1c17e8220 -[UIResponder doesNotRecognizeSelector:]
4 CoreFoundation 0x194fd49c8 _forwarding_
5 CoreFoundation 0x194fd665c _CF_forwarding_prep_0
6 UIKitCore 0x1c15c8e88 -[UIInputWindowController _aligningInsetsForChildInputViewController:includeSceneBounds:]
7 UIKitCore 0x1c15c98b0 -[UIInputWindowController updateConstraintInsets]
8 UIKitCore 0x1c15cbd94 -[UIInputWindowController hostAppSceneBoundsChanged]
9 UIKitCore 0x1c1a94028 -[UITextEffectsWindow _updateTransformLayer]
10 UIKitCore 0x1c1a947f4 -[UITextEffectsWindow _willSnapshot]
11 UIKitCore 0x1c17c8770 -[UIApplication _beginSnapshotSessionForScene:withSnapshotBlock:]
12 UIKitCore 0x1c17c96f0 -[UIApplication _saveSnapshotWithName:]
13 UIKitCore 0x1c17d4318 125-[UIApplication _updateStateRestorationArchiveForBackgroundEvent:saveState:exitIfCouldNotRestoreState:updateSnapshot:canvas:]_block_invoke_2
14 libdispatch.dylib 0x194a0ca38 _dispatch_call_block_and_release
15 libdispatch.dylib 0x194a0d7d4 _dispatch_client_callout
16 libdispatch.dylib 0x1949bb008 _dispatch_main_queue_callback_4CF$VARIANT$mp
17 CoreFoundation 0x194f60b20 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE
18 CoreFoundation 0x194f5ba58 __CFRunLoopRun
19 CoreFoundation 0x194f5afb4 CFRunLoopRunSpecific
20 GraphicsServices 0x19715c79c GSEventRunModal
21 UIKitCore 0x1c17bcc38 UIApplicationMain
22 Vida 0x1005a9894 main + 12 (AppDelegate.swift:12)
23 libdyld.dylib 0x194a1e8e0 start


Update: resigning and restoring first responder did not resolve the issue (thought it does look much nicer with the privacy screen). Really desperate for a fix here.
Update: SOLVED IT!

We were accidentally doing navigation in the background, which was still happening when we called the completionHandler, which triggered a new snapshot, which crashes when navigation is in progress.

Solution:
inside application(_:, didReceiveRemoteNotification:, fetchCompletionHandler:), before doing any navigation, guard that case .inactive = application.applicationState, otherwise return. That worked for us!

@Burnsides were you able to reproduce applicationState == .background within didReceiveRemoteNotification? When would such a case occur? when it does occur should the navigation still happen?

Every time I try to reproduce, applicationState == .inactive.

Anybody got lucky with reproducing this issue?

We're experiencing this issue on ~5% of users, majority using iOS 15. App crashes on startup, but we're not sure if on cold start or getting back from background.

Looks like this might be some navigation issue. [UIViewController _setViewAppearState:isAnimating:] + 832 adds to it...


Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0

Last Exception Backtrace:
0   CoreFoundation                	0x183701cac __exceptionPreprocess + 216 (NSException.m:200)
1   libobjc.A.dylib               	0x19a770758 objc_exception_throw + 56 (objc-exception.mm:565)
2   CoreFoundation                	0x1837d16d0 -[NSObject(NSObject) doesNotRecognizeSelector:] + 140 (NSObject.m:147)
3   UIKitCore                     	0x18687e610 -[UIResponder doesNotRecognizeSelector:] + 268 (UIResponder.m:659)
4   CoreFoundation                	0x18369bedc ___forwarding___ + 1440 (NSForwarding.m:3577)
5   CoreFoundation                	0x18369b14c _CF_forwarding_prep_0 + 92
6   UIKitCore                     	0x185da2654 -[UIUndoGestureInteraction didMoveToView:] + 112 (UIUndoGestureInteraction.m:195)
7   UIKitCore                     	0x185b5968c _setInteractionView + 84 (UIView.m:17714)
8   UIKitCore                     	0x185cb4ed8 -[UIView(Dragging) addInteraction:] + 484 (UIView.m:17743)
9   UIKitCore                     	0x185e4ebc4 -[UIEditingOverlayViewController _addInteractions] + 248 (UIEditingOverlayViewController.m:85)
10  UIKitCore                     	0x185b70c4c -[UIViewController _setViewAppearState:isAnimating:] + 832 (UIViewController.m:5362)
11  UIKitCore                     	0x18630fc8c __52-[UIViewController _setViewAppearState:isAnimating:]_block_invoke_2 + 192 (UIViewController.m:5422)
12  UIKitCore                     	0x185c8caa8 __52-[UIViewController _setViewAppearState:isAnimating:]_block_invoke + 196 (UIViewController.m:5426)
13  CoreFoundation                	0x18367ccf8 __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ + 16 (NSArrayHelpers.m:10)
14  CoreFoundation                	0x1836aac60 -[__NSArrayI enumerateObjectsWithOptions:usingBlock:] + 152 (NSArrayI.m:109)
15  UIKitCore                     	0x185b70dfc -[UIViewController _setViewAppearState:isAnimating:] + 1264 (UIViewController.m:5403)
16  UIKitCore                     	0x185c58570 -[UIViewController __viewDidAppear:] + 168 (UIViewController.m:5570)
17  UIKitCore                     	0x185c42afc __64-[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:]_block_invoke + 44 (UIViewController.m:5981)
18  UIKitCore                     	0x185df61b4 -[UIViewController _executeAfterAppearanceBlock] + 88 (UIViewController.m:5756)
19  UIKitCore                     	0x185ce5ef0 -[_UIAfterCACommitBlock run] + 64 (_UIAfterCACommitQueue.m:137)
20  UIKitCore                     	0x185bff5bc -[_UIAfterCACommitQueue flush] + 200 (_UIAfterCACommitQueue.m:228)
21  UIKitCore                     	0x185b2c318 _runAfterCACommitDeferredBlocks + 640 (UIApplication.m:2988)
22  UIKitCore                     	0x185b2c9d8 _cleanUpAfterCAFlushAndRunDeferredBlocks + 128 (UIApplication.m:2952)
23  UIKitCore                     	0x185b2cba4 _afterCACommitHandler + 56 (UIApplication.m:3003)
24  CoreFoundation                	0x1836adf34 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32 (CFRunLoop.c:1804)
25  CoreFoundation                	0x18367f578 __CFRunLoopDoObservers + 588 (CFRunLoop.c:1917)
26  CoreFoundation                	0x18367ab0c __CFRunLoopRun + 1012 (CFRunLoop.c:2979)
27  CoreFoundation                	0x18368dd8c CFRunLoopRunSpecific + 572 (CFRunLoop.c:3268)
28  GraphicsServices              	0x19d79a9a0 GSEventRunModal + 160 (GSEvent.c:2200)
29  UIKitCore                     	0x185ec3018 -[UIApplication _run] + 1080 (UIApplication.m:3457)
30  UIKitCore                     	0x185c5729c UIApplicationMain + 2060 (UIApplication.m:5013)
31  MyAppName               	0x10019c5f4 0x100194000 + 34292
32  dyld                          	0x10122c190 start + 444 (dyldMain.cpp:876)

[_UISnapshotWindow actualSceneBounds]: unrecognized selector
 
 
Q