My Crashlytics is showing multiple users experiencing the following crash (see below).
The only way I have been able to recreate this (which I doubt the users are doing) is to bring up the Xcode Touch Bar simulator and switch between generations
whilst the app is running:
The following devices and OSes have reported the crash:
- macOS 12.2.0 MacBookPro16,1
- macOS 12.2.0 MacBookPro15,4
- macOS 12.1.0 MacBookPro15,4
- macOS 12.0.0 MacBookPro15,4
My app is:
- on macOS only
- written in SwiftUI containing an
NSViewController
andNSTextView
- never touching/observing/making reference to the touch bar.
Would anyone know the reason for this crash?
Cannot remove an observer <_NSTouchBarFinderObservation 0x6000026f6260> for the key path "nextResponder" from <GUL_SwiftUI.AppDelegate-0624A6E4-3CE4-4739-BDD0-0721CE556CBA 0x600000290360> because it is not registered as an observer.
2022-02-13 14:28:47.289790 0400 Lyrcs[63176:1681748] [General] (
0 CoreFoundation 0x00000001c1dd41cc __exceptionPreprocess 240
1 libobjc.A.dylib 0x00000001c1b257b8 objc_exception_throw 60
2 Foundation 0x00000001c2c1b96c -[NSObject(NSKeyValueObserverRegistration) _removeObserver:forProperty:] 668
3 Foundation 0x00000001c2c1b67c -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:] 144
4 Foundation 0x00000001c2c1b304 -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:context:] 204
5 AppKit 0x00000001c4f29df8 -[_NSTouchBarFinderObservation invalidate] 316
6 AppKit 0x00000001c4f2a2ec -[NSTouchBarFinder invalidate] 268
7 AppKit 0x00000001c48ae584 -[NSApplicationFunctionRowController _teardown] 104
8 AppKit 0x00000001c48ae31c -[NSApplicationFunctionRowController _sync] 484
9 Foundation 0x00000001c2bfa13c NSKeyValueNotifyObserver 292
10 Foundation 0x00000001c2cc655c NSKeyValueDidChange 356
11 Foundation 0x00000001c2d79770 NSKeyValueDidChangeWithPerThreadPendingNotifications 160
12 AppKit 0x00000001c5173f80 __33 [NSFunctionRowDevice initialize]_block_invoke.1 492
13 AppKit 0x00000001c5174324 ___NSMainRunLoopPerformBlockInModes_block_invoke 44
14 CoreFoundation 0x00000001c1d54708 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ 28
15 CoreFoundation 0x00000001c1d5457c __CFRunLoopDoBlocks 412
16 CoreFoundation 0x00000001c1d531f4 __CFRunLoopRun 800
17 CoreFoundation 0x00000001c1d52734 CFRunLoopRunSpecific 600
18 HIToolbox 0x00000001ca8e4f68 RunCurrentEventLoopInMode 292
19 HIToolbox 0x00000001ca8e4cdc ReceiveNextEventCommon 552
20 HIToolbox 0x00000001ca8e4a9c _BlockUntilNextEventMatchingListInModeWithFilter 72
21 AppKit 0x00000001c48a8ce0 _DPSNextEvent 844
22 AppKit 0x00000001c48a7584 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] 1332
23 AppKit 0x00000001c48995a4 -[NSApplication run] 596
24 AppKit 0x00000001c486ac78 NSApplicationMain 1064
25 SwiftUI 0x00000001e6779c9c $s7SwiftUI6runAppys5NeverOSo21NSApplicationDelegate_So11NSResponderCXcFTf4e_nAA07TestingdG0C_Tg5 148
26 SwiftUI 0x00000001e72a3a54 $s7SwiftUI6runAppys5NeverOxAA0D0RzlF 260
27 SwiftUI 0x00000001e6d3366c $s7SwiftUI3AppPAAE4mainyyFZ 128
CodePudding user response:
Turns out the culprit was Firebase Analytics.
The solution to prevent this crash was to add the FirebaseAppDelegateProxyEnabled
to the info plist and give it a Boolean
value of NO
. Seems like SwiftUI, macOS and Firebase Analytics don't play nicely together.