升级Xcode 15后React Native编译报错:缺失libarclite
解决方案
1. 修复Podfile中的部署目标强制脚本
把你自定义的__apply_Xcode_14_3_RC_post_install_workaround函数替换为更严谨的版本,确保所有Pod的部署目标不低于项目的13.0,避免触发libarclite依赖:
def __apply_Xcode_14_3_RC_post_install_workaround(installer) installer.pods_project.targets.each do |target| target.build_configurations.each do |config| min_target = '13.0' current_target = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] if current_target.to_f < min_target.to_f config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = min_target end # 适配Xcode15的编译设置 config.build_settings['CLANG_ENABLE_MODULES'] = 'YES' end end end
2. 添加Xcode15专属适配配置
在post_install块中新增libarclite相关的处理逻辑:
post_install do |installer| react_native_post_install(installer) $RNMBGL.post_install(installer) __apply_Xcode_12_5_M1_post_install_workaround(installer) __apply_Xcode_14_3_RC_post_install_workaround(installer) # Xcode15 libarclite 错误修复 installer.pods_project.targets.each do |target| target.build_configurations.each do |config| # 移除对libarclite的依赖引用 config.build_settings['OTHER_LDFLAGS'] ||= [] config.build_settings['OTHER_LDFLAGS'].delete_if { |flag| flag.include?('libarclite') } end end end
3. 清理并重新安装Pods
执行以下命令清理旧缓存并重新安装依赖:
cd ios rm -rf Pods Podfile.lock pod deintegrate pod install --repo-update
4. 验证项目部署目标
打开Xcode,确认项目和target的部署目标统一为13.0:
- 点击项目根目录 → 选择
MyProjecttarget →Info标签 → 将Deployment Target设置为iOS 13.0
备选方案:升级最低部署目标到14.0
如果上述步骤无效,建议将项目最低部署目标提升至iOS 14.0(Xcode15对iOS14+的支持更完善):
- 修改Podfile开头的
platform :ios, '14.0' - 在Xcode中同步将项目和target的部署目标改为14.0
- 重新执行
pod install
内容的提问来源于stack exchange,提问作者Engr.Aftab Ufaq
相关产品推荐
相关产品推荐

