iPhone development Unit Testing Linking Problem
I've been trying to determine the cause of this error for days now. Tried doing simple projects by I could not get the unit 开发者_如何学编程tests to work? Does anyone know how to solve this problem?
Building target “ChildTests” of project “Person” with configuration “Debug” — (2 errors) Linking /Users/me/Desktop/Person/build/Debug-iphonesimulator/ChildTests.octest/ChildTests(1 error) ".objc_class_name_Child", referenced from: literal-pointer@__OBJC@__cls_refs@Child in ChildTests.o symbol(s) not found collect2: ld returned 1 exit status
...
Pardon me, I am new to iphone development.
The missing symbol is .objc_class_name_Child
. I'm guessing you have a class called Child
but its implementation file is not being built as part of your test target.
To fix the problem find the file (probably called Child.m
) and make sure your test target is checked in the Targets tab of the file's File->Info.
Linker errors normally mean you've neglected to add a framework or static library to your project and/or neglected to add the header import for the library in question.
What unit test library/framework are you using?
If you're new to the platform, you may be causing yourself unnecessary confusion by trying to start out with unit tests. Unit testing can be very beneficial to delivering a stable final product, however, it doesn't seem to me to be a good place to start out. I would suggest you get your app working first and then add unit tests later once you're sure you're going to develop it to completion.
精彩评论