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

Xcode中纯SPM包Mac测试失败:无法加载.xctest bundle

在macOS 13环境下开发纯SPM包时Xcode无法运行测试的问题

在macOS 13系统中开发纯Swift Package Manager(SPM)包时,出现Xcode无法运行测试的异常:在包根目录执行swift test命令可正常运行测试,但通过Xcode触发测试(按下CMD + u)时失败,报错信息如下:

[loading] Cannot find executable for CFBundle
The bundle “<test target name>.xctest” couldn’t be loaded because its executable couldn’t be located. Try reinstalling the bundle.

查看DerivedData目录可以确认所有二进制文件和bundle已生成,但Xcode似乎没有加载这些bundle的权限。

复现步骤

  • 从Xcode创建全新的SPM包
  • 按下CMD + u运行测试(确保选择的设备为Mac本地机器)
    ⚠️ 测试会出现上述报错信息 ⚠️

系统信息

  • Macbook Pro M1
  • macOS Ventura (13.4.1 (22F82))
  • Xcode 14.3 (14E222b)

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.08 09:27:05