iPhone 16模拟器运行React Native项目遇Xcode构建系统崩溃错误
React Native项目在iPhone 16模拟器运行时触发Xcode构建系统崩溃错误
错误信息:
unexpected service error: The Xcode build system has crashed. Build again to continue.
已尝试的排查步骤
- 清理构建文件夹(
Shift + Cmd + K) - 重启Xcode和模拟器
- 删除Derived Data文件夹
- 重启电脑
- 确认使用最新版Xcode
- 设置Xcode构建系统为“New Build System (Default)”
系统详情
- Xcode版本:16.0
- macOS版本:15.0
- React Native版本:0.72.4
额外修复方案
- 切换到Legacy构建系统:打开Xcode,进入
File -> Project/Workspace Settings,将Build System改为Legacy Build System,保存后重新构建项目。 - 重置iPhone 16模拟器:打开模拟器,选择
Hardware -> Erase All Content and Settings,完成重置后再次运行项目。 - 适配版本兼容性:RN 0.72.4未适配Xcode 16,可尝试升级React Native至0.73及以上版本,或降级Xcode到15.x版本测试。
- 清理依赖缓存并重装:
# npm用户执行 npm cache clean --force rm -rf node_modules package-lock.json npm install # yarn用户执行 yarn cache clean rm -rf node_modules yarn.lock yarn install - 重新生成iOS Pod依赖:
rm -rf ios/Podfile ios/Podfile.lock ios/Pods ios/build npx pod-install ios - 查看Xcode崩溃日志定位问题:打开Xcode的
Window -> Reports,找到最近的构建崩溃报告,查看具体报错模块,针对性处理。 - 关闭增量构建:在Xcode项目的
Build Settings中搜索Incremental Build,将其设置为No,然后重新构建。
内容的提问来源于stack exchange,提问作者Tanveer Shah
相关产品推荐
相关产品推荐

