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

升级Xcode15&iOS17后Podfile的DT_TOOLCHAIN_DIR与签名合并报错

解决Xcode 15/iOS 17下DT_TOOLCHAIN_DIR、代码签名问题及post_install代码合并方法

你遇到的两个问题可以通过合并成单个post_install代码块解决,同时避免Flutter/Flutter.h找不到的问题。正确的合并代码如下:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      # 修复DT_TOOLCHAIN_DIR路径错误
      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 }

      # 禁用代码签名配置
      config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
      config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
      config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
    end
  end
end

关键注意事项

  • Podfile中仅保留一个post_install块:多个独立块可能导致配置修改冲突或执行顺序问题,进而引发头文件找不到的异常
  • 若仍出现Flutter/Flutter.h缺失问题,可执行以下操作:
    • 运行flutter clean清理项目缓存,再重新执行pod install
    • 确认使用的Flutter SDK为适配Xcode 15的稳定版本
    • 检查Xcode偏好设置中,Locations选项下的Command Line Tools已选中Xcode 15

内容的提问来源于stack exchange,提问作者Lee Wei Chin

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.07 09:04:59