Reputation: 31
I have an iOS app and I receive some crashes related to _objc_msgSend. I only know that this crash happens when backgrounding the app. The crash log:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes: 0x0000000000000001, 0x0000000000000000
VM Region Info: 0 is not in any region. Bytes before following region: 4334944256
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 102620000-102628000 [ 32K] r-x/r-x SM=COW /var/containers/Bundle/Application/C85DDECD-E4EE-4590-B8AE-116E75F437A0
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [32190]
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 libobjc.A.dylib 0x000000019acf0c90 lookUpImpOrForward + 72 (objc-runtime-new.mm:7399)
1 libobjc.A.dylib 0x000000019acec0c4 _objc_msgSend_uncached + 68 (:-1)
2 UIKitCore 0x00000001a52d07d4 -[UIViewController dealloc] + 860 (UIViewController.m:3275)
3 UIKitCore 0x00000001a5398e14 -[UINavigationController dealloc] + 296 (UINavigationController.m:871)
4 UIKitCore 0x00000001a57909ec -[_UISplitViewControllerColumnContents .cxx_destruct] + 44 (UISplitViewControllerPanelImpl.m:439)
5 libobjc.A.dylib 0x000000019acec75c object_cxxDestructFromClass(objc_object*, objc_class*) + 116 (objc-class.mm:457)
6 libobjc.A.dylib 0x000000019acec490 objc_destructInstance + 80 (objc-runtime-new.mm:9125)
7 libobjc.A.dylib 0x000000019acec438 _objc_rootDealloc + 80 (NSObject.mm:2136)
8 CoreFoundation 0x00000001a2db63f8 cow_cleanup + 164 (NSDictionaryM.m:141)
9 CoreFoundation 0x00000001a2db6304 -[__NSDictionaryM dealloc] + 148 (NSDictionaryM.m:407)
10 libobjc.A.dylib 0x000000019acec75c object_cxxDestructFromClass(objc_object*, objc_class*) + 116 (objc-class.mm:457)
11 libobjc.A.dylib 0x000000019acec490 objc_destructInstance + 80 (objc-runtime-new.mm:9125)
12 libobjc.A.dylib 0x000000019acec438 _objc_rootDealloc + 80 (NSObject.mm:2136)
13 UIKitCore 0x00000001a5790a74 -[UISplitViewControllerPanelImpl dealloc] + 100 (UISplitViewControllerPanelImpl.m:704)
14 libobjc.A.dylib 0x000000019acec75c object_cxxDestructFromClass(objc_object*, objc_class*) + 116 (objc-class.mm:457)
15 libobjc.A.dylib 0x000000019acec490 objc_destructInstance + 80 (objc-runtime-new.mm:9125)
16 libobjc.A.dylib 0x000000019acec438 _objc_rootDealloc + 80 (NSObject.mm:2136)
17 UIKitCore 0x00000001a50a6900 -[UIResponder dealloc] + 124 (UIResponder.m:195)
18 UIKitCore 0x00000001a52d090c -[UIViewController dealloc] + 1172 (UIViewController.m:3306)
19 libobjc.A.dylib 0x000000019ace9f84 AutoreleasePoolPage::releaseUntil(objc_object**) + 212 (NSObject.mm:918)
20 libobjc.A.dylib 0x000000019ace9e10 objc_autoreleasePoolPop + 260 (NSObject.mm:2184)
21 UIKitCore 0x00000001a50d1904 -[_UIAfterCACommitBlock run] + 92 (_UIAfterCACommitQueue.m:155)
22 UIKitCore 0x00000001a50d16d4 -[_UIAfterCACommitQueue flush] + 164 (_UIAfterCACommitQueue.m:228)
23 UIKitCore 0x00000001a50d15ec _runAfterCACommitDeferredBlocks + 496 (UIApplication.m:3123)
24 UIKitCore 0x00000001a50d1378 _cleanUpAfterCAFlushAndRunDeferredBlocks + 100 (UIApplication.m:3087)
25 UIKitCore 0x00000001a50b8a88 _afterCACommitHandler + 64 (UIApplication.m:3138)
26 CoreFoundation 0x00000001a2ddfd3c __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36 (CFRunLoop.c:1789)
27 CoreFoundation 0x00000001a2dde738 __CFRunLoopDoObservers + 552 (CFRunLoop.c:1902)
28 CoreFoundation 0x00000001a2ddde50 __CFRunLoopRun + 1028 (CFRunLoop.c:2983)
29 CoreFoundation 0x00000001a2ddd968 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
30 GraphicsServices 0x00000001e70d34e0 GSEventRunModal + 164 (GSEvent.c:2196)
31 UIKitCore 0x00000001a5250edc -[UIApplication _run] + 888 (UIApplication.m:3692)
32 UIKitCore 0x00000001a5250518 UIApplicationMain + 340 (UIApplication.m:5282)
33 SwiftUI 0x00000001a7c17860 closure #1 in KitRendererCommon(_:) + 168 (UIKitApp.swift:51)
34 SwiftUI 0x00000001a7c176a8 runApp<A>(_:) + 152 (UIKitApp.swift:14)
35 SwiftUI 0x00000001a78339fc static App.main() + 132 (App.swift:114)
36 Myapp 0x0000000102629654 static iOSApp.$main() + 52 (iOSApp.swift:0)
37 Myapp 0x0000000102629654 main + 64
38 dyld 0x00000001c62fed84 start + 2240 (dyldMain.cpp:1298)
Do you have any idea where this crash might originate or why it happens? The crash log indicates it's related to a deallocated instance. Is this related to the AppDelegate? How can I determine the line where the exception happens?
UINotificationFeedbackGenerator
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
let generator = UINotificationFeedbackGenerator()
generator.notificationOccurred(.success)
}
@EnvironmentObject, the way declared:
@EnvironmentObject var appState: AppStateForUser
the class its an ObservableObject:
class AppStateForUser: ObservableObject {
@Published var selectedIndex: Int = 0
}
And the way that I use in code:
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
self.appState.selectedIndex = 1
}
Could these 2 snippets be the cause of the crash? If so, which one of them or which one of them its the most likely to be related to the crash?
Upvotes: 1
Views: 219