I am using OCMock 3.0.2, which I've installed through cocoapods for my test target:
platform :ios, '7.0'
xcodeproj 'myProject.xcodeproj'
target :myTestTarget do
pod 'OCMock', '~> 3.0.2'
end
link_with "myTestTarget"
In my test file (myTest.mm), I've included OCMock and want to try out the new verify-in-place strategy, like so:
- (void) test_myTest
{
MyObject *obj = [MyObject new];
id robotMock = OCMPartialMock(obj);
[obj testMethod];
// some asserts
OCMVerify([obj _internalMethodToBeCalled]);
}
So far seems normal. However, when I tried to run this specific test case, I am getting linker error:
Undefined symbols for architecture i386:
"OCMMakeLocation(objc_object*, char const*, int)", referenced from:
-[MyTests test_myTest] in MyTests.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I verified that OCMock was pulled in correctly and OCMLocation.h/m files are referenced too. I see that OCMMakeLocation seems to be an extern function but the .m file is there as a dependent project in my pods build target, but somehow it is not being linked. I have to make my test to be .mm since I am including some c++ files. Why would this be the problem for OCMock?