【发布时间】:2012-01-19 06:27:31
【问题描述】:
我正在尝试将单元测试添加到我的项目中,这就是我正在做的事情:
-
添加目标 -> Cocoa Touch 单元测试包
product: AuthyTestscompany Identifier:com.authy.comproject: authy所以生成的捆绑器标识符是:com.authy.AuthyTests
如果我运行 command+U(Product -> test) 就可以运行单元测试。
现在我从我的项目中添加一个库,所以 #include "otp.h" AuthyTests.h
添加一些对 AuthyTest.m (
[Otp foo];) 的调用,我得到一个错误:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_Otp", referenced from:
objc-class-ref in AuthyTests.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我尝试过的事情:
1.我尝试添加 authy.app 作为对 AuthyAppTests 构建阶段的 TargetDependencies 的依赖。
2.Targets -> AuthyTests -> BuildSettings -> Build Active Architechture Only -> Yes
我使用的是 xcode 4.2。我还尝试了这个网站上的所有内容:
http://twobitlabs.com/2011/06/adding-ocunit-to-an-existing-ios-project-with-xcode-4/
在 XCode 上设置 UnitTest 缺少什么?
【问题讨论】:
标签: iphone objective-c ios xcode4.2