It turns out I was missing a Copy Files build phase for the framework, which apparently may lead to a variety of issues.
This works for me:
- Add a Copy Files phase to the unit test target's build phases. I positioned it right before the Run Script phase, making it the second-to-last one.
- Drag the OCMock.framework item from the project navigator onto the phase in order to add it; adding it using the
+
button doesn't work in Xcode 4.6 (maybe because frameworks are directories?). - Set the phase's destination to "Frameworks".
- In the unit test target's build settings, look for Runpath Search Paths and add the entry
@loader_path/../Frameworks
.
This way, the unit test executable will be able to find the framework at runtime. Note that you can also use "Products Directory" as the destination of the Copy Files phase, in which case you can skip the fourth step.