0

我创建了一个单元测试目标,它依赖于我的主要目标。如果我错了,请纠正我,但添加依赖项应该将所有类从我的主要目标添加到单元测试目标。在单元测试目标中导入类是可行的,但是一旦我尝试在我的测试目标中使用这些类,我就会收到以下编译错误:

Apple Match-O 链接器 (ID) 错误 - _OBJC_CLASS_$_LoginViewcontroller”,引用自:

我知道我可以手动将每个文件添加到我的单元测试目标中,但这似乎不是正确的方法。任何人都知道为什么添加依赖项不能按预期工作?或者有什么办法可以解决这个问题?

不想设置“测试主机”。

4

1 回答 1

0

I have to correct you there: Adding a dependency should not add all the classes from yoru main target to the unit test target. It just causes your main target to be built. You additionally have to actually link to your main target.

Update: you can link to your target in the "Link Binary With Libraries" build phase in the "Build Phases" tab.

于 2012-09-06T17:04:23.190 回答