ReactNative App Crashes when Deployed to TestFlight

I am working on a ReactNative app that is working on the simulator and works when debugging on a plugged in device (iPhone 7).

When I download the app from TestFlight on the same device, the app crashes immediately upon opening the app. The app is built using ReactNative 0.67.2 and the app has Hermes disabled.

I've looked into other questions but the answers don't resolve the issue we are facing.

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

Last Exception Backtrace:
0   CoreFoundation                	0x182379c9c __exceptionPreprocess + 216 (NSException.m:200)
1   libobjc.A.dylib               	0x19952d758 objc_exception_throw + 56 (objc-exception.mm:565)
2   SoberConnectionApp            	0x104f49cd4 RCTFatal + 668 (RCTAssert.m:146)
3   SoberConnectionApp            	0x104f748e8 __28-[RCTCxxBridge handleError:]_block_invoke + 700 (RCTCxxBridge.mm:1226)
4   libdispatch.dylib             	0x182045194 _dispatch_call_block_and_release + 24 (init.c:1517)
5   libdispatch.dylib             	0x182046198 _dispatch_client_callout + 16 (object.m:560)
6   libdispatch.dylib             	0x181ff25d0 _dispatch_main_queue_callback_4CF$VARIANT$mp + 940 (inline_internal.h:2601)
7   CoreFoundation                	0x1823357e8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 (CFRunLoop.c:1795)
8   CoreFoundation                	0x1822f30e8 __CFRunLoopRun + 2528 (CFRunLoop.c:3144)
9   CoreFoundation                	0x182305d7c CFRunLoopRunSpecific + 572 (CFRunLoop.c:3268)
10  GraphicsServices              	0x19c57a9a0 GSEventRunModal + 160 (GSEvent.c:2200)
11  UIKitCore                     	0x184b3805c -[UIApplication _run] + 1080 (UIApplication.m:3493)
12  UIKitCore                     	0x1848cdce0 UIApplicationMain + 2028 (UIApplication.m:5046)
13  SoberConnectionApp            	0x104e7e1ac main + 88 (main.m:7)
14  dyld                          	0x10541c190 start + 444 (dyldMain.cpp:876)

Incident Identifier: 042F8078-D7DA-49CC-AA1C-3F66A599F843
Hardware Model:      iPhone9,3
Process:             SoberConnectionApp [2407]
Path:                /private/var/containers/Bundle/Application/B2DF9876-D074-4D5B-B785-283D960F4570/SoberConnectionApp.app/SoberConnectionApp
Identifier:          com.SoberConnection
Version:             0.6 (6)
AppStoreTools:       13E500
AppVariant:          1:iPhone9,3:15
Beta:                YES
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.SoberConnection [690]

Date/Time:           2022-04-24 22:41:53.0372 -0500
Launch Time:         2022-04-24 22:41:52.7871 -0500
OS Version:          iPhone OS 15.1 (19B74)
Release Type:        User
Baseband Version:    6.00.00
Report Version:      104

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

Last Exception Backtrace:
0   CoreFoundation                	0x182379c9c __exceptionPreprocess + 216 (NSException.m:200)
1   libobjc.A.dylib               	0x19952d758 objc_exception_throw + 56 (objc-exception.mm:565)
2   SoberConnectionApp            	0x104f49cd4 RCTFatal + 668 (RCTAssert.m:146)
3   SoberConnectionApp            	0x104f748e8 __28-[RCTCxxBridge handleError:]_block_invoke + 700 (RCTCxxBridge.mm:1226)
4   libdispatch.dylib             	0x182045194 _dispatch_call_block_and_release + 24 (init.c:1517)
5   libdispatch.dylib             	0x182046198 _dispatch_client_callout + 16 (object.m:560)
6   libdispatch.dylib             	0x181ff25d0 _dispatch_main_queue_callback_4CF$VARIANT$mp + 940 (inline_internal.h:2601)
7   CoreFoundation                	0x1823357e8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 (CFRunLoop.c:1795)
8   CoreFoundation                	0x1822f30e8 __CFRunLoopRun + 2528 (CFRunLoop.c:3144)
9   CoreFoundation                	0x182305d7c CFRunLoopRunSpecific + 572 (CFRunLoop.c:3268)
10  GraphicsServices              	0x19c57a9a0 GSEventRunModal + 160 (GSEvent.c:2200)
11  UIKitCore                     	0x184b3805c -[UIApplication _run] + 1080 (UIApplication.m:3493)
12  UIKitCore                     	0x1848cdce0 UIApplicationMain + 2028 (UIApplication.m:5046)
13  SoberConnectionApp            	0x104e7e1ac main + 88 (main.m:7)
14  dyld                          	0x10541c190 start + 444 (dyldMain.cpp:876)

Thread 0 name:
Thread 0 Crashed:
0   libsystem_kernel.dylib        	0x00000001bbde29e8 __pthread_kill + 8
1   libsystem_pthread.dylib       	0x00000001dc351824 pthread_kill + 208 (pthread.c:1610)
2   libsystem_c.dylib             	0x000000018c7f30b4 abort + 120 (abort.c:118)
3   libc++abi.dylib               	0x0000000199622e1c abort_message + 128 (abort_message.cpp:78)
4   libc++abi.dylib               	0x0000000199614bec demangling_terminate_handler() + 296 (cxa_default_handlers.cpp:71)
5   libobjc.A.dylib               	0x00000001995330c8 _objc_terminate() + 124 (objc-exception.mm:701)
6   libc++abi.dylib               	0x00000001996222cc std::__terminate(void (*)()) + 16 (cxa_handlers.cpp:59)
7   libc++abi.dylib               	0x0000000199622274 std::terminate() + 60 (cxa_handlers.cpp:88)
8   libdispatch.dylib             	0x00000001820461ac _dispatch_client_callout + 36 (object.m:563)
9   libdispatch.dylib             	0x0000000181ff25d0 _dispatch_main_queue_callback_4CF$VARIANT$mp + 940 (inline_internal.h:2601)
10  CoreFoundation                	0x00000001823357e8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 (CFRunLoop.c:1795)
11  CoreFoundation                	0x00000001822f30e8 __CFRunLoopRun + 2528 (CFRunLoop.c:3144)
12  CoreFoundation                	0x0000000182305d7c CFRunLoopRunSpecific + 572 (CFRunLoop.c:3268)
13  GraphicsServices              	0x000000019c57a9a0 GSEventRunModal + 160 (GSEvent.c:2200)
14  UIKitCore                     	0x0000000184b3805c -[UIApplication _run] + 1080 (UIApplication.m:3493)
15  UIKitCore                     	0x00000001848cdce0 UIApplicationMain + 2028 (UIApplication.m:5046)
16  SoberConnectionApp            	0x0000000104e7e1ac main + 88 (main.m:7)
17  dyld                          	0x000000010541c190 start + 444 (dyldMain.cpp:876)

Thread 1:
0   libsystem_pthread.dylib       	0x00000001dc3459e8 start_wqthread + 0

Thread 2:
0   libsystem_pthread.dylib       	0x00000001dc3459e8 start_wqthread + 0

Thread 3:
0   libsystem_pthread.dylib       	0x00000001dc3459e8 start_wqthread + 0

Thread 4 name:
Thread 4:
0   libsystem_kernel.dylib        	0x00000001bbddcb10 mach_msg_trap + 8
1   libsystem_kernel.dylib        	0x00000001bbddd134 mach_msg + 72 (mach_msg.c:119)
2   CoreFoundation                	0x00000001822eeac0 __CFRunLoopServiceMachPort + 368 (CFRunLoop.c:2646)
3   CoreFoundation                	0x00000001822f2ba8 __CFRunLoopRun + 1184 (CFRunLoop.c:3000)
4   CoreFoundation                	0x0000000182305d7c CFRunLoopRunSpecific + 572 (CFRunLoop.c:3268)
5   Foundation                    	0x0000000183a3e00c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 232 (NSRunLoop.m:373)
6   Foundation                    	0x0000000183a7d18c -[NSRunLoop(NSRunLoop) runUntilDate:] + 88 (NSRunLoop.m:420)
7   UIKitCore                     	0x0000000184ab5d58 -[UIEventFetcher threadMain] + 512 (UIEventFetcher.m:1167)
8   Foundation                    	0x0000000183a8aefc __NSThread__start__ + 792 (NSThread.m:972)
9   libsystem_pthread.dylib       	0x00000001dc3473a4 _pthread_start + 116 (pthread.c:891)
10  libsystem_pthread.dylib       	0x00000001dc3459fc thread_start + 8

Thread 5:
0   libsystem_pthread.dylib       	0x00000001dc3459e8 start_wqthread + 0

Thread 6:
0   libsystem_pthread.dylib       	0x00000001dc3459e8 start_wqthread + 0

Thread 7:
0   libsystem_pthread.dylib       	0x00000001dc3459e8 start_wqthread + 0

Thread 8 name:
Thread 8:
0   libsystem_kernel.dylib        	0x00000001bbddcb10 mach_msg_trap + 8
1   libsystem_kernel.dylib        	0x00000001bbddd134 mach_msg + 72 (mach_msg.c:119)
2   CoreFoundation                	0x00000001822eeac0 __CFRunLoopServiceMachPort + 368 (CFRunLoop.c:2646)
3   CoreFoundation                	0x00000001822f2ba8 __CFRunLoopRun + 1184 (CFRunLoop.c:3000)
4   CoreFoundation                	0x0000000182305d7c CFRunLoopRunSpecific + 572 (CFRunLoop.c:3268)
5   SoberConnectionApp            	0x0000000104f70244 +[RCTCxxBridge runRunLoop] + 264 (RCTCxxBridge.mm:384)
6   Foundation                    	0x0000000183a8aefc __NSThread__start__ + 792 (NSThread.m:972)
7   libsystem_pthread.dylib       	0x00000001dc3473a4 _pthread_start + 116 (pthread.c:891)
8   libsystem_pthread.dylib       	0x00000001dc3459fc thread_start + 8


Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000000   x1: 0x0000000000000000   x2: 0x0000000000000000   x3: 0x0000000000000000
    x4: 0x0000000199625e55   x5: 0x000000016af863c0   x6: 0x000000000000006e   x7: 0x0000000000000000
    x8: 0x0000000105464580   x9: 0x8fb902a17f6e52e1  x10: 0x000000016af85e20  x11: 0x000000000000000b
   x12: 0x0000000000000000  x13: 0x0000000000000000  x14: 0x0000000000000010  x15: 0x0000000000000001
   x16: 0x0000000000000148  x17: 0x0000000000000000  x18: 0x0000000000000000  x19: 0x0000000000000006
   x20: 0x0000000000000103  x21: 0x0000000105464660  x22: 0x00000002801eaf80  x23: 0x0000000000000000
   x24: 0x0000000000000000  x25: 0x00000002801e8500  x26: 0x0000000105464660  x27: 0x000000000000000f
   x28: 0x0000000002ffffff   fp: 0x000000016af86330   lr: 0x00000001dc351824
    sp: 0x000000016af86310   pc: 0x00000001bbde29e8 cpsr: 0x40000000
   esr: 0x56000080  Address size fault


Binary Images:
0x104e78000 - 0x10511bfff SoberConnectionApp arm64  <efc28d1ad2af3bf6bed13e330799bdfc> /private/var/containers/Bundle/Application/B2DF9876-D074-4D5B-B785-283D960F4570/SoberConnectionApp.app/SoberConnectionApp
0x105404000 - 0x105457fff dyld arm64  <5e7ef5771cc5369aa04d28fbba883086> /usr/lib/dyld
0x181fe2000 - 0x182064fff libdispatch.dylib arm64  <56aa6e938d8e32feac73d3e79b1ba2f5> /usr/lib/system/libdispatch.dylib
0x1822e8000 - 0x182722fff CoreFoundation arm64  <ea9c1df294c7379bbf8d970335b1552f> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x183a26000 - 0x183d06fff Foundation arm64  <86d8a58db71f34c683e0014b2b835f1d> /System/Library/Frameworks/Foundation.framework/Foundation
0x18464c000 - 0x185dd5fff UIKitCore arm64  <fb5c2d366a053355b898d8d3c163d02e> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
0x18c7d4000 - 0x18c84efff libsystem_c.dylib arm64  <5700e26c19b735c9b739e62c325f4fcc> /usr/lib/system/libsystem_c.dylib
0x199519000 - 0x19954efff libobjc.A.dylib arm64  <78e77e2874d0371aa2466d41374ba19a> /usr/lib/libobjc.A.dylib
0x199610000 - 0x199628fff libc++abi.dylib arm64  <a69670f6fe393e03a3f051781fbe97b5> /usr/lib/libc++abi.dylib
0x19c579000 - 0x19c581fff GraphicsServices arm64  <af306dd576573f63912fabc225106419> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x1bbddc000 - 0x1bbe0dfff libsystem_kernel.dylib arm64  <28a82cbdb2103662af9e636819d8909a> /usr/lib/system/libsystem_kernel.dylib
0x1dc341000 - 0x1dc354fff libsystem_pthread.dylib arm64  <ce7eb78851553c3888d812f1419fa5fa> /usr/lib/system/libsystem_pthread.dylib

EOF
Answered by CodyTMinus in 711616022

So after digging into the console I found this error:

No bundle URL present.

Make sure you're running a packager server or have included a .jsbundle file in your application bundle.

This lead me to this Stack Overflow post and the 7th response is what helped me find and now it's working when deployed via TestFlight. Lastly, I needed to find another script to include the assets in the build phases - bundle resources. I can't include the link because the forum does not allow it, but the updated package.json script is below

react-native bundle --minify --entry-file index.js --platform ios --dev false --bundle-output ./ios/main.jsbundle --assets-dest ./ios

Hopefully this post can help others with the same issue!

Your app crashed due to an unhandled language exception. Looking at frames 3 through 2 in the Last Exception Backtrace you posted, it seems likely that this was caused by an error within your third-party runtime.

As to what that error was, my general advice is that you escalation such issues via the support channel for your runtime. In this case, however, there’s a step you should take before that, namely, looking at the system log on the device. It seems likely that this error will have logged something useful there.

To view the device’s system log:

  1. Connect it to your Mac via USB.

  2. Run the Console app on the Mac.

  3. Select your iOS device on the left.

This generates a lot of traffic so you’ll need to do some filtering. One option is to find the process ID (pid) of your app and filter on that. When your app dies, it’s likely that its last message (or thereabouts) will include the info you need.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

So after digging into the console I found this error:

No bundle URL present.

Make sure you're running a packager server or have included a .jsbundle file in your application bundle.

This lead me to this Stack Overflow post and the 7th response is what helped me find and now it's working when deployed via TestFlight. Lastly, I needed to find another script to include the assets in the build phases - bundle resources. I can't include the link because the forum does not allow it, but the updated package.json script is below

react-native bundle --minify --entry-file index.js --platform ios --dev false --bundle-output ./ios/main.jsbundle --assets-dest ./ios

Hopefully this post can help others with the same issue!

ReactNative App Crashes when Deployed to TestFlight
 
 
Q