objective-c - 为 iOS 构建 OCUnit 应用程序测试目标时出现链接器错误

标签 objective-c ios ocunit

我的 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 不需要在链接时访问目标文件来进行实例调用,但需要在链接时访问以进行类调用。有人可以指出我的文档以确认这一点吗?

这个问题类似于这些问题:

Imported files not recognized in OCUnit

OCUnit will not allow me to use my own data types

最佳答案

请参阅我在 Linking error for unit testing with XCode 4? 中的回答

关于objective-c - 为 iOS 构建 OCUnit 应用程序测试目标时出现链接器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7210211/

相关文章:

ios - 是否可以使用现有的 View Controller 为 iPad 实现 Split View

ios - 滑入一个 UIButton 并在达到一定距离时按下另一个 UIButton

objective-c - 为什么在单元测试中使用 UITableViewCell 会导致 Trace/BPT 陷阱?

xcode - 如何将 iOS UI 测试设置为构建依赖项,如 OCUnit?

ios - 比较两个图像以检查它们是否相同

objective-c - 最后一个对象差异的 NSArray 索引

iphone - 如何以编程方式在 iPhone 中查找掉话?

ios - 从 3rd 方应用程序 ios 控制背景音乐

ios - 滚动时如何停止在 UICollectionViewCell 内的 YTPlayerView 中播放视频?

iPhone 自动化 : Setting order of tests in OCUnit or FoneMonkey