我的 OCUnit 目标中包含一个应用程序测试。我可以在我的应用程序宿主目标中的类上调用实例方法,但我不能调用类方法。如果我调用类方法(如 alloc
),我会收到以下链接器错误:
Undefined symbols for architecture armv6:
"_OBJC_CLASS_$_DiceGameViewController", referenced from:
objc-class-ref in DiceGameViewControllerTest.o
(maybe you meant: _OBJC_CLASS_$_DiceGameViewControllerTest)
ld: symbol(s) not found for architecture armv6
collect2: ld returned 1 exit status
我假设这是因为 Objective-C 不需要在链接时访问目标文件来进行实例调用,但需要在链接时访问以进行类调用。有人可以指出我的文档以确认这一点吗?
这个问题类似于这些问题:
最佳答案
请参阅我在 Linking error for unit testing with XCode 4? 中的回答
关于objective-c - 为 iOS 构建 OCUnit 应用程序测试目标时出现链接器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7210211/