Search code examples
iosxcodeocmock

XCode - iOS - <OCMock/OCMock.h> file not found


I Have an iOS application that I am trying to add OCMock to in order to better unit test it. I've followed the instruction on ocmock.org as well as instructions I've found in other places but still I cannot get my test code to compile.

Here's what I've done

Added the source code to my project directory enter image description here

Create the groups in my project to mimic my file system enter image description here

I selected the option to add to my test targets so the framework was added appropriately as well as the Library Search Path enter image description here enter image description here

Then I manually added the headers to the Header Search Path enter image description here

And added the -ObjC linker flag enter image description here

Then when I go to import the header file, I get the file not found error enter image description here

Any ideas what I am missing here???


Solution

  • You have the search path test/libraries/OCMock. Then you have #import <OCMock/OCMock.h>.

    This fails because there is no file test/libraries/OCMock/OCMock/OCMock.h.

    You use the search path test/libraries, or you can create a prefix directory to hold OCMock and have the search path point at that.

    I generally have a directory with the library name and version number before the actually directory.

    The directory test/libraries/OCMock-X.X.X could contain the OCMock directory. That way the search path still be more specific: test/libraries/OCMock-X.X.X and you still use OCMock/OCMock.h as the include.