没有这样的模块<产品模块名称>在XCode单元测试中 [英] No such module <product module name> in XCode Unit test

查看:49
本文介绍了没有这样的模块<产品模块名称>在XCode单元测试中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我混合了Objective-C和Swift项目,并尝试为其编写单元测试。
我的项目名称是:Alphaproject
我的产品模块名称是:Alphaproject
我设置为YES在我的主要目标(Alphaproject)
中定义模块并设置为YES EnableTestability仅用于调试

I have a mixed objective-c and Swift project and I try to write Unit tests for it. My project name is: Alphaproject my product module name is: Alphaproject I set to YES Defines Module in my main Target (Alphaproject) and set to YES EnableTestability for Debug only in this same Target.

在我的Test类中,我尝试导入我的产品模块名称:

In my Test class, I try to import my product module name:

@可测试的导入Alphaproject

@testable import Alphaproject

附加说明:


  • 我所有的项目文件都只是一部分的主要目标

  • 我的测试文件只是测试目标的一部分

  • 我的测试方案设置为构建调试配置。

  • 我也尝试清理Build文件夹(ALT + Clean)

  • 该项目在编译或尝试运行测试时没有任何错误,除了没有这样的模块Alphaproject

  • all my projects files are only part of the main target
  • my test files are only part of the test target
  • My scheme for Test is set to Build Debug configuration.
  • I also tried to clean the Build folder (ALT + Clean)
  • The project doesn't have any error when compiling or trying to run tests except this "No such module Alphaproject"

还有其他想法吗?

推荐答案

好!问题出在我的有效架构的调试配置中有arm64的事实。
由于主要目标在Valid Architectures中也不包含arm64,因此它显然找不到模块...
我认为苹果可以在显示正确错误方面做得更好。 (苹果,如果您读过我的话,请)

OK! The problem was coming from the fact that I had arm64 in my Debug configuration for Valid Architectures. As the main target also doesn't contain arm64 in Valid Architectures, It couldn't apparently find the module... I think apple can make better work on displaying a proper error here. (Apple, if you read me, please)

这篇关于没有这样的模块<产品模块名称>在XCode单元测试中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆