Expo EAS构建iOS Release版本出现白屏问题求助
Expo iOS Release构建后白屏问题排查
问题描述
- 使用
expo start运行应用完全正常,无任何报错 - 执行
npx expo run:ios --configuration Release构建后,应用显示空白白屏,调试困难 - 曾遇到以下错误,卸载
expo-update包后错误消除,但白屏问题依旧:
{"code":"UpdateFailedToLoad","message":"\"channel-name\" is not allowedto be empty. The headers \"expo-runtime-version\", \"expo-channel-name\", and \"expo-platform\" arerequired. They can also be set with the query parameters \"runtime-version\", \"channel-name\", and\"platform\".","timestamp":1681832747000,"level":"error","stacktrace"
- 当前使用的
eas.json配置:
{ "cli": { "version": ">= 3.9.2" }, "build": { "development": { "developmentClient": true, "distribution": "internal", "ios": { "resourceClass": "m-medium" }, "channel": "development" }, "preview": { "distribution": "internal", "ios": { "resourceClass": "m-medium" }, "channel": "preview" }, "production": { "ios": { "resourceClass": "m-medium" }, "channel": "production" } }, "submit": { "production": {} } }
排查与解决步骤
1. 开启Release模式调试
- 连接iOS设备到电脑,打开Xcode的
Window > Devices and Simulators,选中设备后点击Open Console,捕获应用运行时的日志 - 在代码关键位置添加
console.log,通过Xcode控制台查看输出,定位白屏触发点
2. 清理Expo Update残留配置
- 检查
app.json中是否存在updates字段,若有直接移除 - 搜索项目代码,删除所有引用
expo-updates的逻辑(比如Updates.checkForUpdateAsync()这类调用)
3. 补全构建配置
- 在
eas.json的build.production节点中添加runtimeVersion配置,示例:
"production": { "ios": { "resourceClass": "m-medium" }, "channel": "production", "runtimeVersion": "1.0.0" }
- 同步
app.json中的expo.runtimeVersion字段,确保与eas配置一致
4. 校验依赖兼容性
- 执行
npx expo install --check检查依赖与当前Expo SDK的兼容性 - 更新不兼容的依赖包到适配版本
5. 清理构建缓存
- 执行
npx expo prebuild --clean清除预构建缓存 - 删除iOS目录下的
build文件夹,重新执行构建命令
6. 检查启动逻辑
- 确认
App.js或入口文件中没有依赖__DEV__判断的逻辑在Release模式下失效 - 排查启动时的异步操作(如API请求、存储读取)是否存在未捕获的错误,添加错误捕获逻辑
内容的提问来源于stack exchange,提问作者Tufan Çağkan Sökmen
相关产品推荐
相关产品推荐

