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

安装Xcode 15.0后无法运行Flutter应用,遇DT_TOOLCHAIN_DIR报错

解决Xcode 15.0下Flutter应用报错DT_TOOLCHAIN_DIR cannot be used to evaluate LIBRARY_SEARCH_PATHS, use TOOLCHAIN_DIR instead

方法一:升级Flutter到兼容版本

  • 执行flutter upgrade,把Flutter升级到3.13及以上的稳定版(官方已针对Xcode15修复该问题)
  • 升级完成后执行flutter clean清理缓存,再重新运行项目

方法二:手动修改iOS Podfile配置(无需升级Flutter)

  • 打开项目中的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
  • 进入ios目录执行pod install,之后回到项目根目录重新运行Flutter应用

方法三:更新第三方依赖库

  • 检查pubspec.yaml中的第三方依赖,查看是否有适配Xcode15的新版本,替换为最新版本
  • 执行flutter pub upgrade更新所有依赖,再重新构建项目

内容的提问来源于stack exchange,提问作者Code Hunter

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.10 16:57:07