解决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版本发现还是以前的版本,可以先尝试卸载旧版本再重新安装。

相关推荐
恋猫de小郭1 小时前
Swift 6.3 正式发布支持 Android ,它能在跨平台发挥什么优势?
android·前端·flutter
harder3214 小时前
Swift 面向协议编程的 RMP 模式
开发语言·ios·mvc·swift·策略模式
leluckys5 小时前
Jenkins CI/CD 持续集成专题十二、iOS-Jenkins自动化打包集成
ios·ci/cd·jenkins
leluckys5 小时前
Jenkins CI/CD 持续集成专题八- jenkins 之 iOS 打包及上传至蒲公英
ios·ci/cd·jenkins
i-阿松!5 小时前
PCB板子+ flutter前端 + go后端
物联网·flutter·pcb工艺·go1.19
leluckys5 小时前
Jenkins CI/CD 持续集成专题十一、jenkins打包ios脚本证书
ios·ci/cd·jenkins
leluckys5 小时前
Jenkins CI/CD 持续集成专题十-jenkins 可以通过api 打ios包
ios·ci/cd·jenkins
壹方秘境5 小时前
作为开发者,我们需要的可能不是Wireshark那样的数据包分析工具,也不是Stream、ProxyPin那样的抓包工具
后端·ios
恋猫de小郭5 小时前
Flutter 3.41.6 版本很重要,你大概率需要更新一下
android·前端·flutter
和沐阳学逆向14 小时前
iOS逆向_古法逆向_Instagram最新版抓包
macos·ios·cocoa