Search code examples
objective-ciosocunit

Linker errors when building OCUnit application test target for iOS


I have an Application Test included in my OCUnit target. I can call instance methods on classes in my Application Host target, but I cannot call class methods. If I call a class method (like alloc), I get the following linker error:

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

I assume this is because Objective-C doesn't need access to the object file at link time to make instance calls, but does need access at link time for class calls. Can someone point me to documentation to confirm this?

This question is similar to these questions:

Imported files not recognized in OCUnit

OCUnit will not allow me to use my own data types


Solution

  • See my answer in Linking error for unit testing with XCode 4?