You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何解决EAS Build构建的iOS App启动崩溃问题

iOS构建包启动崩溃排查求助

背景

基于React Native采用Expo托管工作流开发应用,本地expo start运行正常,日志无报错。

问题

配置并运行EAS Build后构建全量成功,但IPA包在iOS模拟器运行或通过Transporter上传至Apple账号用于TestFlight时,应用启动即崩溃,仅显示启动页后闪退。

崩溃日志(片段)

iOS设备日志中崩溃线程信息如下:

Thread 1 name:   Dispatch queue: com.facebook.react.ExceptionsManagerQueue
Thread 1 Crashed:
0   libsystem_kernel.dylib                 0x1de9f7160 __pthread_kill + 8
1   libsystem_pthread.dylib                0x1ef1141ac pthread_kill + 268
2   libsystem_c.dylib                      0x1a86fcc8c abort + 180
3   libc++abi.dylib                        0x1ef053b8c abort_message + 132
4   libc++abi.dylib                        0x1ef043a80 demangling_terminate_handler() + 336
5   libobjc.A.dylib                        0x19a355d3c _objc_terminate() + 144
6   libc++abi.dylib                        0x1ef052f28 std::__terminate(void (*)()) + 20
7   libc++abi.dylib                        0x1ef052ec4 std::terminate() + 56
8   libdispatch.dylib                      0x1a8698ff0 _dispatch_client_callout + 40
9   libdispatch.dylib                      0x1a86a0694 _dispatch_lane_serial_drain + 672
10  libdispatch.dylib                      0x1a86a11e0 _dispatch_lane_invoke + 384
11  libdispatch.dylib                      0x1a86abe10 _dispatch_workloop_worker_thread + 652
12  libsystem_pthread.dylib                0x1ef10ddf8 _pthread_wqthread + 288
13  libsystem_pthread.dylib                0x1ef10db98 start_wqthread + 8

已补全之前缺失的堆栈导航依赖,但问题依旧,推测可能是app.json配置或依赖版本不匹配导致。

配置文件

package.json

{
  "name": "app name",
  "version": "1.0.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@react-native-async-storage/async-storage": "1.17.11",
    "@react-navigation/bottom-tabs": "6.5.7",
    "@react-navigation/native": "6.1.6",
    "@react-navigation/native-stack": "6.9.12",
    "@stripe/stripe-react-native": "0.23.3",
    "expo": "48.0.9",
    "expo-firebase": "0.0.0-alpha.0",
    "expo-status-bar": "1.4.4",
    "firebase": "9.18.0",
    "formik": "2.2.9",
    "lottie-react-native": "5.1.4",
    "openai": "3.2.1",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.71.8",
    "react-native-dotenv": "3.4.8",
    "react-native-element-dropdown": "2.9.0",
    "react-native-gesture-handler": "2.12.0",
    "react-native-vector-icons": "9.2.0",
    "react-native-web": "0.18.11",
    "yup": "1.0.2",
    "react-native-screens": "3.20.0",
    "react-native-safe-area-context": "4.5.0"
  },
  "private": true,
  "devDependencies": {
    "@babel/core": "7.21.3"
  }
}

app.json

{
  "expo": {
    "name": "name",
    "slug": "slug",
    "version": "1.0.1",
    "orientation": "portrait",
    "icon": "./assets/Icon.png",
    "userInterfaceStyle": "light",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "infoPlist": {
        "NSCameraUsageDescription": "This app supports use of camera for scanning",
        "UIAppFonts": [
          "LucidaGrande.ttf",
          "LucidaGrandeBold.ttf",
          "Luminari.ttf"
        ]
      },
      "config": {
        "usesNonExemptEncryption": false
      },
      "supportsTablet": true,
      "bundleIdentifier": "id",
      "buildNumber": "10"
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#ffffff"
      },
      "package": "id"
    },
    "web": {
      "favicon": "./assets/favicon.png"
    },
    "extra": {
      "eas": {
        "projectId": "uid"
      }
    },
    "owner": "owner"
  }
}

排查方案

  • 优先处理expo-firebase依赖冲突:当前使用的expo-firebase是废弃的测试版本,Expo 48已不再支持该包,且项目中同时安装了firebase 9.18.0,两者冲突会直接导致启动崩溃。建议移除expo-firebase,改用官方推荐的expo-firebase-core等独立Firebase模块,并确保与firebase版本兼容。
  • 验证字体资源配置:检查app.json中UIAppFonts配置的字体文件是否确实存在于项目assets目录中。若字体文件缺失,iOS构建包启动时会因找不到资源崩溃,可暂时移除字体配置,重新构建测试。
  • 检查环境变量注入:使用react-native-dotenv时,需确认EAS Build的构建配置中是否正确注入了所有必要的环境变量。关键变量缺失会导致应用初始化失败,可在eas.json中补充环境变量配置,或暂时移除该依赖测试。
  • 获取完整崩溃堆栈:通过eas build --debug生成调试包,再用Xcode连接设备查看完整的崩溃日志,定位具体错误代码位置,这比仅看系统线程日志更精准。

内容的提问来源于stack exchange,提问作者Bromox

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.18 14:23:13