Xcode 3.2.3 , IOS4 and OCMock

To unit test our iPhone developments we rely heavily on Google-Toolbox-for-Mac and OCMock.
After updating to the iphone SDK4 (IOS4) and Xcode 3.2.3 we had an unpleasant surprise : our testing frameworks refused to compile and as of today we have no information about how to solve this situation.
Nevetheless we managed to resolve this problem :

The build error we had was :

Undefined symbols:
"_OBJC_CLASS_$_OCMockObject", referenced from:
objc-class-ref-to-OCMockObject in WebServiceTest.o
ld: symbol(s) not found

We used to simply add the OCMock.framework to the “Link Binary With Libraries” build phase.
But it seems you can no longer use the pre-compiled library from the download section of the OCMock website

To make OCMock work with Xcode 3.2.3 you have to :

  • Delete ocmock.framework, the copy file phase, and any search path linking to ocmock header.
  • check out the latest version from ocmock svn repo : http://svn.mulle-kybernetik.com/OCMock/trunk
  • Build the OCMockPhoneSim target
  • Copy the libOCMock.a and Headers folder in your project folder
  • Add the libOCMock.a to your project framework and add a link to the headers folder in your target library search path.

You build again but…. nothing happens.

After OCMock, now it’s the runscript from Google-Toolbox-for-Mac that freezes on this line :

SBSetAccelerometerClientEventsEnabled failed: (ipc/
send) invalid destination port

Once again check out the top of the trunk of the GTM svn repository and replace all the GTM files :

http://code.google.com/p/google-toolbox-for-mac/wiki/iPhoneUnitTesting

Now you can build your test target again.

Un commentaire sur “Xcode 3.2.3 , IOS4 and OCMock”

  • Thanks for this - this error was making me tear my hair out! Annoyingly this problem still requires checking out and building OCMock from source even though there has been a release of OCMock since this blog post.
    1. Leave a Reply

      Your email address will not be published. Required fields are marked *


      This form is protected by Google Recaptcha