I am using OCMock 3.0.2, which I installed via cocoapods for my test purpose:
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 enabled OCMock and want to try a new in-place validation strategy, for example:
- (void) test_myTest
{
MyObject *obj = [MyObject new];
id robotMock = OCMPartialMock(obj);
[obj testMethod];
OCMVerify([obj _internalMethodToBeCalled]);
}
It still seems normal. However, when I tried to run this specific test case, I get a 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 checked that OCMock was retracted correctly, and links to OCMLocation.h / m are also listed. I see that OCMMakeLocation is apparently an extern function, but the .m file is present as a dependent project in my pods build target, but for some reason this is not related. I have to do my test as .mm, since I am including some C ++ files. Why would this be a problem for OCMock?