IOS Production build crashes directly after opening the app

Hello Everyone,

I have a problem with the IOS part of my App. The Android part works fine. When I create an development build (eas build --profile development --platform ios) there is no problem. But the preview and production builds crash directly after opening the App. The EAS build pipelines have no problems except for one message

fatal error: module 'React' in AST file '/Users/expo/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/1XDLP1ZNNJOAB/React-ISQBUSD1JGEA.pcm' (imported by AST file '/Users/expo/Library/Developer/Xcode/DerivedData/MY_APP_NAME-hkvdfgprzzhwypayqwweanuiqofc/Build/Intermediates.noindex/ArchiveIntermediates/MY_APP_NAME/PrecompiledHeaders/MY_APP_NAME-Bridging-Header-swift_3BATV8FO0GBUP-clang_1XDLP1ZNNJOAB.pch') is not defined in any loaded module map file; maybe you need to load '/Users/expo/workingdir/build/ios/Pods/Headers/Public/React-Core/React/React-Core.modulemap'?

I’m not sure if the this is related to my problem because it doesn’t lead to a build failure and the dev Build has the same error message but doesn’t crash.

The App is already published to TestFlight. Therefore, I have the crash reports from the device.


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

Thread 13 name:
Thread 13 Crashed:
0 libsystem_kernel.dylib 0x00000001e5b5a200 __pthread_kill + 8
1 libsystem_pthread.dylib 0x00000001f5d971ac pthread_kill + 268 (pthread.c:1670)
2 libsystem_c.dylib 0x00000001b0951ca0 abort + 180 (abort.c:118)
3 libsystem_c.dylib 0x00000001b09a8890 __assert_rtn + 272 (assert.c:96)
4 MY_APP_NAME 0x000000010487f8d4 facebook::jsc::JSCRuntime::~JSCRuntime() + 136 (JSCRuntime.cpp:393)
5 MY_APP_NAME 0x000000010487f97c ~JSCRuntime + 4 (JSCRuntime.cpp:383)
6 MY_APP_NAME 0x000000010487f97c facebook::jsc::JSCRuntime::~JSCRuntime() + 12 (JSCRuntime.cpp:383)
7 MY_APP_NAME 0x00000001046d88f0 __release_shared + 40 (shared_ptr.h:177)
8 MY_APP_NAME 0x00000001046d88f0 __release_shared + 40 (shared_ptr.h:219)
9 MY_APP_NAME 0x00000001046d88f0 std::__1::shared_ptrfacebook::react::CallInvoker::~shared_ptr() + 64 (shared_ptr.h:959)
10 MY_APP_NAME 0x000000010488cea4 ~shared_ptr + 4 (shared_ptr.h:957)
11 MY_APP_NAME 0x000000010488cea4 facebook::react::JSIExecutor::~JSIExecutor() + 268 (JSIExecutor.h:71)
12 MY_APP_NAME 0x000000010488cd90 ~JSIExecutor + 4 (JSIExecutor.h:71)
13 MY_APP_NAME 0x000000010488cd90 facebook::react::JSIExecutor::~JSIExecutor() + 12 (JSIExecutor.h:71)
14 MY_APP_NAME 0x00000001047c9d64 operator() + 20 (function.h:505)
15 MY_APP_NAME 0x00000001047c9d64 operator() + 20 (function.h:1182)
16 MY_APP_NAME 0x00000001047c9d64 facebook::react::tryAndReturnError(std::__1::function<void ()> const&) + 32 (RCTCxxUtils.mm:74)
17 MY_APP_NAME 0x00000001047d61ec facebook::react::RCTMessageThread::tryFunc(std::__1::function<void ()> const&) + 24 (RCTMessageThread.mm:69)
18 MY_APP_NAME 0x00000001047d694c operator() + 20 (function.h:505)
19 MY_APP_NAME 0x00000001047d694c operator() + 20 (function.h:1182)
20 MY_APP_NAME 0x00000001047d694c operator() + 24 (RCTMessageThread.mm:61)
21 MY_APP_NAME 0x00000001047d694c __invoke<(lambda at /Users/expo/workingdir/build/node_modules/react-native/React/CxxBridge/RCTMessageThread.mm:60:12) &> + 24 (type_traits:3918)
22 MY_APP_NAME 0x00000001047d694c __call<(lambda at /Users/expo/workingdir/build/node_modules/react-native/React/CxxBridge/RCTMessageThread.mm:60:12) &> + 24 (invoke.h:61)
23 MY_APP_NAME 0x00000001047d694c operator() + 24 (function.h:178)
24 MY_APP_NAME 0x00000001047d694c std::__1::__function::__func<facebook::react::RCTMessageThread::runSync(std::__1::function<void ()>)::$_0, std::__1::allocator<facebook::react::RCTMessageThread::runSync(std::__1::function<void ()>… + 40 (function.h:352)
25 MY_APP_NAME 0x00000001047d5fa0 operator() + 20 (function.h:505)
26 MY_APP_NAME 0x00000001047d5fa0 operator() + 20 (function.h:1182)
27 MY_APP_NAME 0x00000001047d5fa0 invocation function for block in facebook::react::RCTMessageThread::runAsync(std::__1::function<void ()>) + 44 (RCTMessageThread.mm:45)
28 CoreFoundation 0x00000001a94ab924 CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK + 28 (CFRunLoop.c:1822)
29 CoreFoundation 0x00000001a95140ac __CFRunLoopDoBlocks + 368 (CFRunLoop.c:1864)
30 CoreFoundation 0x00000001a94e4508 __CFRunLoopRun + 2452 (CFRunLoop.c:3218)
31 CoreFoundation 0x00000001a94e91e4 CFRunLoopRunSpecific + 612 (CFRunLoop.c:3390)
32 MY_APP_NAME 0x00000001047bf398 +[RCTCxxBridge runRunLoop] + 264 (RCTCxxBridge.mm:378)
33 Foundation 0x00000001a3912ce8 NSThread__start + 716 (NSThread.m:968)
34 libsystem_pthread.dylib 0x00000001f5d916cc _pthread_start + 148 (pthread.c:893)
35 libsystem_pthread.dylib 0x00000001f5d90ba4 thread_start + 8

Expo: 45
Workflow: bare
eas-cli: 2.5.1

{
    "scripts": {
        "start": "expo start",
        "android": "react-native run-android",
        "ios": "react-native run-ios",
        "web": "expo start --web",
        "eject": "expo eject",
        "test": "jest",
        "devStart": "expo start -p 80",
        "expo-ios": "expo run:ios",
        "eas-android": "eas build --profile development --platform android",
        "eas-android-preview": "eas build --profile preview --platform android",
        "eas-ios": "eas build --profile development --platform ios",
        "eas-ios-preview": "eas build --profile preview --platform ios",
        "eas-ios-production": "eas build --profile production --platform ios",
        "start-prod": "npx expo start --no-dev --minify"
    },
    "jest": {
        "preset": "jest-expo",
        "transformIgnorePatterns": [
            "node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|@sentry/.*)"
        ],
        "collectCoverage": true,
        "coverageReporters": [
            "html"
        ],
        "setupFiles": [
            "./jest/jestSetupFile.js"
        ]
    },
    "dependencies": {
        "@ant-design/icons": "^4.7.0",
        "@react-native-async-storage/async-storage": "~1.17.3",
        "@react-native-mapbox-gl/maps": "^8.5.0",
        "@react-navigation/drawer": "^6.4.3",
        "@react-navigation/elements": "^1.3.4",
        "@react-navigation/material-top-tabs": "^6.2.2",
        "@react-navigation/native": "^6.0.11",
        "@react-navigation/stack": "^6.2.2",
        "@reduxjs/toolkit": "^1.8.2",
        "@sentry/react-native": "^3.1.1",
        "@shopify/flash-list": "^1.2.1",
        "@types/i18n-js": "^3.8.2",
        "@types/react-native-signature-capture": "^0.4.2",
        "@types/react-native-snap-carousel": "^3.8.5",
        "@types/redux-logger": "^3.0.9",
        "axios": "^0.22.0",
        "babel-plugin-transform-remove-console": "^6.9.4",
        "date-fns": "^2.27.0",
        "eas-cli": "^2.5.1",
        "expo": "^45.0.6",
        "expo-application": "~4.1.0",
        "expo-asset": "~8.5.0",
        "expo-auth-session": "~3.6.1",
        "expo-barcode-scanner": "~11.3.0",
        "expo-camera": "~12.2.0",
        "expo-cli": "^6.0.6",
        "expo-constants": "~13.1.1",
        "expo-dev-client": "^1.0.1",
        "expo-device": "~4.2.0",
        "expo-file-system": "~14.0.0",
        "expo-image-manipulator": "~10.3.1",
        "expo-local-authentication": "~12.2.0",
        "expo-location": "~14.2.2",
        "expo-mail-composer": "~11.2.0",
        "expo-media-library": "~14.1.0",
        "expo-modules-autolinking": "^0.9.0",
        "expo-modules-core": "^0.9.2",
        "expo-network": "~4.2.0",
        "expo-random": "~12.2.0",
        "expo-screen-orientation": "~4.2.0",
        "expo-secure-store": "~11.2.0",
        "expo-status-bar": "~1.3.0",
        "expo-updates": "~0.13.4",
        "i18n-js": "^3.8.0",
        "iso8601-duration": "^2.1.1",
        "npm-license-crawler": "^0.2.1",
        "react": "17.0.2",
        "react-dom": "17.0.2",
        "react-native": "0.68.2",
        "react-native-app-auth": "^6.4.0",
        "react-native-base64": "^0.2.1",
        "react-native-dropdown-picker": "^5.4.0",
        "react-native-elements": "^3.4.2",
        "react-native-exception-handler": "^2.10.10",
        "react-native-gesture-handler": "~2.2.1",
        "react-native-get-random-values": "~1.8.0",
        "react-native-image-picker": "^4.8.4",
        "react-native-logs": "^4.0.1",
        "react-native-pager-view": "5.4.15",
        "react-native-paper": "^4.12.1",
        "react-native-photo-manipulator": "^1.2.7",
        "react-native-reanimated": "~2.8.0",
        "react-native-safe-area-context": "4.2.4",
        "react-native-screens": "~3.11.1",
        "react-native-signature-canvas": "^4.3.0",
        "react-native-snap-carousel": "^3.9.1",
        "react-native-tab-view": "^3.1.1",
        "react-native-vector-icons": "^9.0.0",
        "react-native-web": "0.17.7",
        "react-native-webview": "11.18.1",
        "react-native-zip-archive": "^6.0.8",
        "react-redux": "^7.2.8",
        "realm": "^10.20.0-beta.5",
        "redux": "^4.2.0",
        "redux-logger": "^3.0.6",
        "redux-thunk": "^2.4.0",
        "sentry-expo": "^4.2.0",
        "uuid": "^8.3.2"
    },
    "devDependencies": {
        "@babel/core": "^7.12.9",
        "@types/jest": "^27.0.2",
        "@types/react": "~17.0.21",
        "@types/react-native": "~0.66.12",
        "@types/react-native-base64": "^0.2.0",
        "@types/uuid": "^8.3.1",
        "jest": "^27.3.1",
        "jest-expo": "^44.0.0",
        "typescript": "~4.3.5"
    },
    "private": true,
    "name": "MY_APP_NAME",
    "version": "0.0.1"
}

I tried to replace a lot of code in the AppDelegate.mm I found during seraching for this problem. Also from a freshly created and ejected Expo 45 example project.
When replacing almost the entire code from the App.tsx with a simple Text it works.
Furthermore, expo run:ios and npx expo start --no-dev --minify have also no problems.

I hope some of you have an idea how to solve this. I’m stuck on this Issue for some time now. If you need additional information, ask in the comments.

Thanks in advance :slight_smile:

The problem was solved by enabling hermes in the Podfile with :hermes_enabled => true

I’m glad you have it working!

By the way:

As far as I know, it’s not recommended to have eas-cli or expo-cli as dependencies/devDependencies. They should be installed globally instead.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.