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
相关产品推荐
相关产品推荐

