Linker Error: iPhone Unit Test Bundle referencing App classes
Posted
by ohhorob
on Stack Overflow
See other posts from Stack Overflow
or by ohhorob
Published on 2009-11-11T05:41:24Z
Indexed on
2010/06/12
6:13 UTC
Read the original article
Hit count: 256
Starting with an app already in development, I have carried out the instructions in the iPhone Development Guide – Unit Testing Applications
I can successfully include and use my App's classes in Application-style tests that run on the device, and output their results to the console.
If I add the following line of code:
STAssertTrue([viewController isKindOfClass:[LoginViewController class]], @"Top view controller is not LoginViewController");
The following build error is generated:
Undefined symbols:
"_OBJC_CLASS_$_LoginViewController", referenced from:
__objc_classrefs__DATA@0 in LoginViewTest.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
I can provide more configuration information for the project and the Testing target, but the setup works file without the [LoginViewController class]
line in the test source.
Without that line, I can reference the class, use it's properties and send it messages successfully.
Is there a linking build setting, or bundle loading option that is required when attempting to use an App class in this fashion? Or should I find another type of test to confirm that the class of an object is the expected one?
© Stack Overflow or respective owner