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

升级Xcode 15后构建iOS应用报错:DT_TOOLCHAIN_DIR无法评估LIBRARY_SEARCH_PATHS

解决Xcode 15构建iOS应用时DT_TOOLCHAIN_DIR错误的方案

核心原因

Xcode 15废弃了DT_TOOLCHAIN_DIR环境变量,改用TOOLCHAIN_DIR,你用到的objectbox_flutter_libs: ^2.2.1和firebase_core: ^2.16.0版本配置中仍在使用旧变量,导致构建失败。

具体解决方法

方法1:升级依赖到兼容版本

  • objectbox_flutter_libs:升级至>=2.10.0版本(该版本已修复Xcode 15适配问题)
  • firebase_core:升级至>=2.19.0版本(Firebase官方在该版本后完成Xcode 15适配)

执行命令更新依赖:

flutter pub upgrade objectbox_flutter_libs firebase_core

方法2:临时修改Podfile适配(无法升级依赖时用)

在iOS目录下的Podfile末尾添加以下代码,强制替换变量:

post_install do |installer|
  installer.pods_project.targets.each do |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

添加后重新安装Pod:

cd ios && pod install --repo-update

方法3:清除构建缓存(上述方法无效时尝试)

  • 清除Flutter缓存:flutter clean
  • 清除Pod缓存:cd ios && pod deintegrate && pod cache clean --all
  • 重新初始化依赖:flutter pub get && cd ios && pod install

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.10 17:42:03