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

向现有Xcode项目添加Framework时提示Module not found的排查求助

排查Swift Framework在现有项目中"No such module"错误的额外检查项

我从零创建了一个简单的Swift Framework,将其添加到新建的App项目中可以正常使用,测试另一个新建项目时也能正常运行。但将该Framework添加到现有项目/工作区后,构建App时出现以下错误:

No such module 'TestFramework1'

我使用Apple Silicon设备上的Xcode 14.3创建测试App和Framework,已尝试了Stack Overflow及Apple开发者论坛中提到的多种解决方案,但均无效:

  • 针对iPhone模拟器构建失败,真机构建同样失败
  • Framework已正确添加到“Frameworks, libraries, content”列表中
  • 打开的是工作区而非项目文件
  • 已添加Framework的递归搜索路径
  • 已彻底清理项目:删除派生数据、Pods文件夹、Podfile.lock,重新安装Pods并打开工作区
  • App scheme的“Find implicit Dependencies”已开启
  • 主App与Framework的iOS部署目标一致(iOS 14)
  • Podfile中未使用use_frameworks!,而是使用use_modular_headers!
  • Pods项目的“Build active architecture only”设置为NO

Framework配置:

  • Architecture = Standard Architecture (arm64)
  • Build Active Architecture Only = YES
  • Excluded architecture = ""
  • Supported platforms = iOS
  • Build libraries for distribution = NO
  • Valid architectures (VALID_ARCHS) = 不存在

App项目配置:

  • Architecture = Standard Architecture (arm64)
  • Build Active Architecture Only = YES
  • Excluded architecture = "i386"
  • Supported platforms = iOS
  • Build libraries for distribution: NO
  • Valid architectures (VALID_ARCHS) = 不存在

新建项目中可正常使用该Framework,但现有项目出现上述错误,除上述排查项外,还需检查哪些内容?


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.24 17:22:15