I imagine that this is a common occurrence when a new version of the iPhone SDK comes out but I figured I’d put it out there for the droves of development teams who will take the plunge with the update this coming week.

If your iOS project relies on OCMock and you just upgraded to the iOS 4.1 SDK (and you upped the Base SDK on the target to 4.1) then chances are your unit test projects aren’t building.  To get it working again:

  1. Checkout the OCMock trunk: http://svn.mulle-kybernetik.com/OCMock/trunk
  2. Open the OCMock project in XCode
  3. Change the Base SDK on the OCMockPhoneSim target to iOS Simulator 4.1 (see Base SDK vs. Active SDK for why).
  4. Build the target.
  5. Copy libOCMock.a and Headers from the build/$(CONFIG)-iphonesimulator folder to wherever you were keeping them before.
That should allow you to link and run but if your experience is anything like mine you’ll be getting a bunch of unexplained errors like “An internal error occurred when handling command output: -[XCBuildLogCommandInvocationSection testName]: unrecognized selector sent to instance”.  Highly annoying but ultimately it will still report “X out of X tests passed” although with all those errors I’m less inclined to trust it.
Thanks to Vincent Daubry for pointing me in the right direction when he experienced the problem during the last major update.