解决Xcode15报错:DT_TOOLCHAIN_DIR cannot be used to evaluate LIBRARY_SEARCH_PATHS

出现场景

更新了一些三方库,升级了Xcode, 编译IOS出现以下错误。

shell 复制代码
Failed to build iOS app
Could not build the precompiled application for the device.
Error (Xcode): DT_TOOLCHAIN_DIR cannot be used to evaluate LIBRARY_SEARCH_PATHS, use TOOLCHAIN_DIR instead

出现场景

这是Cocoapos老版本的一个bug,主要是在更新了Xcode15之后编译ios产生的问题。有两种解决方法。更新Cocoapods版本或者修改Podfile文件配置.

解决方案

修改Podfile

Podfile 复制代码
post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    # 新增以下内容
    target.build_configurations.each do |config|
      xcconfig_path = config.base_configuration_reference.real_path
      xcconfig = File.read(xcconfig_path)
      xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
      File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }
    end
  end
end

更新Cocoapos

更新cocoapos版本到1.13.0以上

shell 复制代码
$ sudo gem install cocoapods

更新完成后查看版本号

shell 复制代码
$ pod --version
1.15.2

如果更新后查看pod版本发现还是以前的版本,可以先尝试卸载旧版本再重新安装。

相关推荐
2501_915921433 小时前
抓包鹰 Traceeagle 解除证书绑定,SSL Pinning 解除
网络·网络协议·网络安全·ios·adb·https·ssl
大熊猫侯佩7 小时前
Xcode 预览新升级:arguments 让界面调试井井有条
swiftui·xcode·swift
梦想的颜色10 小时前
AI 时代小白 VibeCoding 做 APP:UniApp(含 Uni‑X)、Flutter 与 React Native+Expo全维度技术选型对比指南
flutter·react native·app·uniapp·vibecoding·unippx·app产品
人月神话Lee12 小时前
我做了个不要账号、不要定位权限的旅行 App,聊聊那些「不做」的决定
ios·ai编程·产品
坚果的博客13 小时前
Flutter-OH 3.44.9-dev 悄然上线|首个 OpenHarmony Canary 预览版上线
flutter
大龄秃头程序员13 小时前
Flutter 动画随笔:业务里真正高频的几类控件
flutter
天空之城--14 小时前
Android Flutter行业最新动态与实用参考(2026年8月第2周)
android·flutter
恋猫de小郭15 小时前
Flutter 3.47 发布,快来看看有什么更新吧
android·前端·flutter
大龄秃头程序员1 天前
一次 Flutter 动画 Demo 的整理与复盘
flutter