React native app crashing on Launch

The app works in debug mode. Please help me understand why my app is crashing in release mode only.

OS: macOS 11.4 react: 16.11.0 react-native: 0.62.2 Xcode: 12.5

__NSCFURLLocalSessionConnection _didFinishWithError:] + 244 (SessionConnection.mm:1190) 16 CFNetwork 0x000000019a058378 invocation function for block in URLConnectionLoader::protocolDidFail(__CFError*) + 52 (URLConnectionLoader.cpp:1090) 17 CFNetwork 0x0000000199f6d654 invocation function for block in SessionConnectionLoadable::withLoaderClientAsync(void (LoaderClientInterface*) block_pointer) + 36

AFAICT this has nothing to do with CFNetwork. Consider this:

Triggered by Thread:  7

Now look at the backtrace of that thread:

Thread 7 name:
Thread 7 Crashed:
0   libsystem_kernel.dylib  … 0x1c7ac2000 + 168756
1   libsystem_pthread.dylib … 0x1e5533000 + 10908
2   libsystem_c.dylib       … __abort + 116 (abort.c:147)
3   libsystem_c.dylib       … abort + 116 (abort.c:118)
4   libc++abi.dylib         … abort_message + 132 (abort_message.cpp:78)
5   libc++abi.dylib         … demangling_terminate_handler() + 308 (cxa_default_handlers.cpp:67)
6   libobjc.A.dylib         … _objc_terminate() + 144 (objc-exception.mm:701)
7   intercity               … CLSTerminateHandler() + 344 (CLSException.mm:310)
8   libc++abi.dylib         … std::__terminate(void (*)()) + 20 (cxa_handlers.cpp:59)
9   libc++abi.dylib         … std::terminate() + 48 (cxa_handlers.cpp:88)
10  libdispatch.dylib       … _dispatch_client_callout + 40 (object.m:562)
11  libdispatch.dylib       … _dispatch_lane_serial_drain + 620 (inline_internal.h:2557)
12  libdispatch.dylib       … _dispatch_lane_invoke + 404 (queue.c:3862)
13  libdispatch.dylib       … _dispatch_workloop_worker_thread + 764 (queue.c:6589)
14  libsystem_pthread.dylib … 0x1e5533000 + 14244
15  libsystem_pthread.dylib … 0x1e5533000 + 42828

There’s no references to CFNetwork here. Rather, it looks like something is throwing an unhandled language exception (Objective-C or C++). Check out the Last Exception Backtrace:

Last Exception Backtrace:
0   CoreFoundation          … __exceptionPreprocess + 220 (NSException.m:199)
1   libobjc.A.dylib         … objc_exception_throw + 60 (objc-exception.mm:565)
2   intercity               … RCTFatal + 668 (RCTAssert.m:146)
3   intercity               … -[RCTExceptionsManager reportFatal:stack:exceptionId:suppressRedBox:] + 492 (RCTE…
4   intercity               … -[RCTExceptionsManager reportException:] + 1532 (RCTExceptionsManager.mm:135)
5   CoreFoundation          … __invoking___ + 148
6   CoreFoundation          … -[NSInvocation invoke] + 380 (NSForwarding.m:3448)
7   CoreFoundation          … -[NSInvocation invokeWithTarget:] + 80 (NSForwarding.m:3549)
8   intercity               … -[RCTModuleMethod invokeWithBridge:module:arguments:] + 460 (RCTModuleMethod.mm:5…
9   intercity               … facebook::react::invokeInner(RCTBridge*, RCTModuleData*, unsigned int, folly::dyn…
10  intercity               … operator() + 44 (RCTNativeModule.mm:73)
11  intercity               … invocation function for block in facebook::react::RCTNativeModule::invoke(unsigne…
12  libdispatch.dylib       … _dispatch_call_block_and_release + 32 (init.c:1466)
13  libdispatch.dylib       … _dispatch_client_callout + 20 (object.m:559)
14  libdispatch.dylib       … _dispatch_lane_serial_drain + 620 (inline_internal.h:2557)
15  libdispatch.dylib       … _dispatch_lane_invoke + 404 (queue.c:3862)
16  libdispatch.dylib       … _dispatch_workloop_worker_thread + 764 (queue.c:6589)
17  libsystem_pthread.dylib … 0x1e5533000 + 14244
18  libsystem_pthread.dylib … 0x1e5533000 + 42828

This isn’t really my area of expertise but I believe that frame 4 indicates that your JavaScript code has thrown an exception of some form and this is your third-party environment reporting that.

I’ve no idea how to debug this beyond that; I recommend that you escalate this via the support channel for your third-party environment.

Share and Enjoy

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

React native app crashing on Launch
 
 
Q