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)
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!