App crash on button press

My app crashes when a button is pressed, however only on a small percentage of devices. I can't reproduce it on my end, but I have a crash log from a TestFlight user. Any thoughts on what this crash log could be indicating?

Incident Identifier: 57C65898-3893-4DED-BD68-73CACD7DA125
Distributor ID:      com.apple.TestFlight
Hardware Model:      iPhone16,2
Process:             IntelliCoach [3758]
Path:                /private/var/containers/Bundle/Application/93275963-06CE-49F5-98C5-F40524D137BC/IntelliCoach.app/IntelliCoach
Identifier:          tech.intellicoach.intellicoach
Version:             1.1.10 (94)
AppStoreTools:       16A242b
AppVariant:          1:iPhone16,2:17.4
Beta:                YES
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           tech.intellicoach.intellicoach [1239]

Date/Time:           2024-09-16 10:39:04.8152 -0600
Launch Time:         2024-09-16 10:38:52.5775 -0600
OS Version:          iPhone OS 17.6.1 (21G93)
Release Type:        User
Baseband Version:    1.70.02
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: SIGNAL 6 Abort trap: 6
Terminating Process: IntelliCoach [3758]

Triggered by Thread:  0


Thread 0 name:
Thread 0 Crashed:
0   libsystem_kernel.dylib        	0x00000001d6c142ec __pthread_kill + 8 (:-1)
1   libsystem_pthread.dylib       	0x00000001eaa07c0c pthread_kill + 268 (pthread.c:1721)
2   libsystem_c.dylib             	0x0000000195f13ba0 abort + 180 (abort.c:118)
3   libc++abi.dylib               	0x00000001ea924ca4 abort_message + 132 (abort_message.cpp:78)
4   libc++abi.dylib               	0x00000001ea914e40 demangling_terminate_handler() + 320 (cxa_default_handlers.cpp:72)
5   libobjc.A.dylib               	0x0000000185e4b15c _objc_terminate() + 160 (objc-exception.mm:499)
6   libc++abi.dylib               	0x00000001ea924068 std::__terminate(void (*)()) + 16 (cxa_handlers.cpp:59)
7   libc++abi.dylib               	0x00000001ea92760c __cxa_rethrow + 204 (cxa_exception.cpp:637)
8   libobjc.A.dylib               	0x0000000185e470b4 objc_exception_rethrow + 44 (objc-exception.mm:399)
9   CoreFoundation                	0x000000018df83d88 CFRunLoopRunSpecific + 784 (CFRunLoop.c:3436)
10  GraphicsServices              	0x00000001d29d11a8 GSEventRunModal + 164 (GSEvent.c:2196)
11  UIKitCore                     	0x00000001905bdae8 -[UIApplication _run] + 888 (UIApplication.m:3713)
12  UIKitCore                     	0x0000000190671d98 UIApplicationMain + 340 (UIApplication.m:5303)
13  UIKitCore                     	0x00000001907eb504 UIApplicationMain(_:_:_:_:) + 104 (UIKit.swift:539)
14  IntelliCoach                  	0x00000001007a3bbc specialized static UIApplicationDelegate.main() + 28 (:11)
15  IntelliCoach                  	0x00000001007a3bbc static AppDelegate.$main() + 28 (AppDelegate.swift:0)
16  IntelliCoach                  	0x00000001007a3bbc main + 120
17  dyld                          	0x00000001b175b154 start + 2356 (dyldMain.cpp:1298)

Thread 1:
0   libsystem_pthread.dylib       	0x00000001eaa010c4 start_wqthread + 0 (:-1)

Thread 2:
0   libsystem_pthread.dylib       	0x00000001eaa010c4 start_wqthread + 0 (:-1)

Thread 3:
0   libsystem_pthread.dylib       	0x00000001eaa010c4 start_wqthread + 0 (:-1)

Thread 4 name:
Thread 4:
0   libsystem_kernel.dylib        	0x00000001d6c096c8 mach_msg2_trap + 8 (:-1)
1   libsystem_kernel.dylib        	0x00000001d6c0cec8 mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib        	0x00000001d6c0cde0 mach_msg_overwrite + 436 (mach_msg.c:0)
3   libsystem_kernel.dylib        	0x00000001d6c0cc20 mach_msg + 24 (mach_msg.c:323)
4   CoreFoundation                	0x000000018df84f5c __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2624)
5   CoreFoundation                	0x000000018df84600 __CFRunLoopRun + 1208 (CFRunLoop.c:3007)
6   CoreFoundation                	0x000000018df83cd8 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
7   Foundation                    	0x000000018cea4b5c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 (NSRunLoop.m:373)
8   Foundation                    	0x000000018cea49ac -[NSRunLoop(NSRunLoop) runUntilDate:] + 64 (NSRunLoop.m:420)
9   UIKitCore                     	0x00000001905d181c -[UIEventFetcher threadMain] + 420 (UIEventFetcher.m:1207)
10  Foundation                    	0x000000018cebb428 __NSThread__start__ + 732 (NSThread.m:991)
11  libsystem_pthread.dylib       	0x00000001eaa0606c _pthread_start + 136 (pthread.c:931)
12  libsystem_pthread.dylib       	0x00000001eaa010d8 thread_start + 8 (:-1)

Thread 5 name:
Thread 5:
0   libsystem_kernel.dylib        	0x00000001d6c104c8 kevent + 8 (:-1)
1   Realm                         	0x0000000101bb32e0 realm::_impl::ExternalCommitHelper::listen() + 156
2   Realm                         	0x0000000101bb3430 void* std::__1::__thread_proxy>, realm::_impl::ExternalCommitHelper::ExternalComm... + 52
3   libsystem_pthread.dylib       	0x00000001eaa0606c _pthread_start + 136 (pthread.c:931)
4   libsystem_pthread.dylib       	0x00000001eaa010d8 thread_start + 8 (:-1)

Thread 6:
0   libsystem_pthread.dylib       	0x00000001eaa010c4 start_wqthread + 0 (:-1)

Thread 7:
0   libsystem_pthread.dylib       	0x00000001eaa010c4 start_wqthread + 0 (:-1)


Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000000   x1: 0x0000000000000000   x2: 0x0000000000000000   x3: 0x0000000000000000
    x4: 0x00000001ea929294   x5: 0x000000016f6b7500   x6: 0x0000000000000035   x7: 0x0000000000000a10
    x8: 0xedbfe29f569c1ba0   x9: 0xedbfe29eb810a560  x10: 0x0000000000000200  x11: 0x000000016f6b7030
   x12: 0x0000000000000000  x13: 0x00000000001ff800  x14: 0x0000000000000010  x15: 0x0000000000000000
   x16: 0x0000000000000148  x17: 0x00000001ee8cbec0  x18: 0x0000000000000000  x19: 0x0000000000000006
   x20: 0x0000000000000103  x21: 0x00000001ee8cbfa0  x22: 0x00000001f5857c70  x23: 0x0000000000000001
   x24: 0x0000000300ca40e0  x25: 0x0000000000000001  x26: 0x00000003035a0490  x27: 0x0000000000000000
   x28: 0x0000000000000001   fp: 0x000000016f6b7470   lr: 0x00000001eaa07c0c
    sp: 0x000000016f6b7450   pc: 0x00000001d6c142ec cpsr: 0x40001000
   esr: 0x56000080  Address size fault


Binary Images:
        0x100748000 -         0x100803fff IntelliCoach arm64  <4fe5a506026f38aa98c5465eb3bb11b7> /private/var/containers/Bundle/Application/93275963-06CE-49F5-98C5-F40524D137BC/IntelliCoach.app/IntelliCoach
        0x100928000 -         0x100933fff libobjc-trampolines.dylib arm64e   /private/preboot/Cryptexes/OS/usr/lib/libobjc-trampolines.dylib
        0x1010f0000 -         0x1011cbfff RealmSwift arm64  <7f4122c59ac63d508e810a5987311590> /private/var/containers/Bundle/Application/93275963-06CE-49F5-98C5-F40524D137BC/IntelliCoach.app/Frameworks/RealmSwift.framework/RealmSwift
        0x1017e0000 -         0x101d9bfff Realm arm64  <71007735efee382ca3184e8bc764de1e> /private/var/containers/Bundle/Application/93275963-06CE-49F5-98C5-F40524D137BC/IntelliCoach.app/Frameworks/Realm.framework/Realm
        0x102190000 -         0x1022f3fff RevenueCat arm64  <7e8b8460ea9e34e6be4ae6b726037ef2> /private/var/containers/Bundle/Application/93275963-06CE-49F5-98C5-F40524D137BC/IntelliCoach.app/Frameworks/RevenueCat.framework/RevenueCat
        0x185e18000 -         0x185e68cf3 libobjc.A.dylib arm64e   /usr/lib/libobjc.A.dylib
        0x18cddd000 -         0x18d952fff Foundation arm64e   /System/Library/Frameworks/Foundation.framework/Foundation
        0x18df31000 -         0x18e45efff CoreFoundation arm64e  <76a3b1983c09323e83590d4978e156f5> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
        0x1901b3000 -         0x191cd4fff UIKitCore arm64e  <9da0d27355063712b73de0149d74c13c> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
        0x195e9e000 -         0x195f1bff3 libsystem_c.dylib arm64e  <7135c2c8ba5836368b46a9e6226ead45> /usr/lib/system/libsystem_c.dylib
        0x1b171e000 -         0x1b17ab937 dyld arm64e  <52039c944da13638bd52020a0b5fa399> /usr/lib/dyld
        0x1d29d0000 -         0x1d29d8fff GraphicsServices arm64e  <3ebbd576e7d83f69bcb5b9810ddcc90e> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
        0x1d6c08000 -         0x1d6c41fef libsystem_kernel.dylib arm64e  <21ee5290d1193c31b948431865a67738> /usr/lib/system/libsystem_kernel.dylib
        0x1ea910000 -         0x1ea92bffb libc++abi.dylib arm64e   /usr/lib/libc++abi.dylib
        0x1eaa00000 -         0x1eaa0cff3 libsystem_pthread.dylib arm64e   /usr/lib/system/libsystem_pthread.dylib
        0x1fffe3000 -         0x20001ffff libSessionUtility.dylib arm64e   /System/Library/PrivateFrameworks/AudioSession.framework/libSessionUtility.dylib

EOF

Please provide more detailed information.

My app crashes when a button is pressed

Any button ? A specific one ?

Is it UIKit or SwiftUI ?

If specific, how is it defined ?

  • In Storyboard ?
  • In code ?

If in code, please show the code.

Also show the action code for the button.

Thanks a bunch for sharing the post and the crash file—they've been incredibly valuable. To make even better use of it, could you please symbolize the crash file? At the moment, we can see that it hits an abort, but symbolic information will greatly enhance our debugging efforts.

There are frames in this crash report that are missing symbol names that identify the code executing at the time of the crash. Adding all of the symbol names to your crash report may help you identify the next step in debugging the crash.

To add the symbol names, follow the advice in Adding identifiable symbol names to a crash report. If you still need help after that, post the symbolicated crash report as an attachment so we can look at it further.

Thanks for the quick replies. I managed to get a symbolicated version to show in XCode, but I can't find a place to export it (the share icon just gives a link that redirects to XCode). How do I export it?

This is the erroring thread

Thanks for the quick replies. I managed to get a symbolicated version to show in XCode, but I can't find a place to export it (the share icon just gives a link that redirects to XCode). How do I export it?

I can tell you exactly why you're getting the crash log you're getting, though I'm afraid it may not be all that helpful when it comes to tracking down the actual problem.

Here is the relevant section from your crash log:


Thread 0 Crashed:
0   libsystem_kernel.dylib        	0x00000001d6c142ec __pthread_kill + 8 (:-1)
1   libsystem_pthread.dylib       	0x00000001eaa07c0c pthread_kill + 268 (pthread.c:1721)
2   libsystem_c.dylib             	0x0000000195f13ba0 abort + 180 (abort.c:118)
3   libc++abi.dylib               	0x00000001ea924ca4 abort_message + 132 (abort_message.cpp:78)
4   libc++abi.dylib               	0x00000001ea914e40 demangling_terminate_handler() + 320 (cxa_default_handlers.cpp:72)
5   libobjc.A.dylib               	0x0000000185e4b15c _objc_terminate() + 160 (objc-exception.mm:499)
6   libc++abi.dylib               	0x00000001ea924068 std::__terminate(void (*)()) + 16 (cxa_handlers.cpp:59)
7   libc++abi.dylib               	0x00000001ea92760c __cxa_rethrow + 204 (cxa_exception.cpp:637)
8   libobjc.A.dylib               	0x0000000185e470b4 objc_exception_rethrow + 44 (objc-exception.mm:399)
9   CoreFoundation                	0x000000018df83d88 CFRunLoopRunSpecific + 784 (CFRunLoop.c:3436)
10  GraphicsServices              	0x00000001d29d11a8 GSEventRunModal + 164 (GSEvent.c:2196)

The call to "GSEventRunModal", "CFRunLoopRunSpecific", and everything below them are standard "boilerplate". All of that is simply the machinery the system uses to run your main thread and you'd basically see exactly the same thing up to that point anytime you paused your main thread.

The rest of the crash is fairly standard as well. This sequence here is the standard process used to handle uncaught exceptions:

4   libc++abi.dylib               	0x00000001ea914e40 demangling_terminate_handler() + 320 (cxa_default_handlers.cpp:72)
5   libobjc.A.dylib               	0x0000000185e4b15c _objc_terminate() + 160 (objc-exception.mm:499)
6   libc++abi.dylib               	0x00000001ea924068 std::__terminate(void (*)()) + 16 (cxa_handlers.cpp:59)
7   libc++abi.dylib               	0x00000001ea92760c __cxa_rethrow + 204 (cxa_exception.cpp:637)
8   libobjc.A.dylib               	0x0000000185e470b4 objc_exception_rethrow + 44 (objc-exception.mm:399)

Having processed the exception, it then called "abort()" which actually crashed your app:

0   libsystem_kernel.dylib        	0x00000001d6c142ec __pthread_kill + 8 (:-1)
1   libsystem_pthread.dylib       	0x00000001eaa07c0c pthread_kill + 268 (pthread.c:1721)
2   libsystem_c.dylib             	0x0000000195f13ba0 abort + 180 (abort.c:118)
3   libc++abi.dylib               	0x00000001ea924ca4 abort_message + 132 (abort_message.cpp:78)

What's missing here is a section that would normally be above the main thread which, labeled "Exception Backtrace". That would have shown where the exception was actually thrown "from", which is the information you actually want to investigate an issue like this.

Why it's missing is almost certainly one of two factors:

  1. (Less likely) "Something else" interfered with the ObjectiveC exception and intentionally discarded the backtrace data. While this is technically possible, I don't think it's likely. The work required is somewhat tricky and, more importantly, most people interacting with this data understand that it needs to be preserved.

  2. (More likely) The exception that was thrown was a C++ exception, NOT an ObjectiveC exception. Many years ago, the ObjectiveC and C++ exception models were integrated so that both languages use the same structures and "process" for exception handling. Note that this integration is why the log jumps between the two libraries:

4   libc++abi.dylib               	0x00000001ea914e40 demangling_terminate_handler() + 320 (cxa_default_handlers.cpp:72)
5   libobjc.A.dylib               	0x0000000185e4b15c _objc_terminate() + 160 (objc-exception.mm:499)
6   libc++abi.dylib               	0x00000001ea924068 std::__terminate(void (*)()) + 16 (cxa_handlers.cpp:59)

However, that integration did not change the actual data contained in the exception. Objective C used the same object ("NSException") for the exception itself and that object is where the missing exception backtrace actually comes from. Unfortunately, C++ doesn't actually HAVE a standards "exception object format", which means it doesn't have a standard way to collect the backtrace the system would normally present. That means that C++ exceptions all inevitably end up looking exactly like the this crash.

The last thing I'll add here is that the exception did NOT come from Apple code. While some of our framework do use C++ and even C++ exceptions, all of those frameworks are VERY careful to ensure that ALL C++ exceptions are caught "inside" the frameworks code and are never allowed to propagate "out" of the frameworks internal implementation.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

App crash on button press
 
 
Q