OCMock on iOS4

Discussion of the OCMock framework. If you have patches we would prefer you to send them to the mailing list, but attaching them to a topic is possible, too.

OCMock on iOS4

Postby nick718 » 21 Jun 2010, 01:23

Has anyone gotten OCMock up and running under XCode 3.2 with iOS 4.0? I have the same setup, where my project references it in the "Frameworks" dir, but it can't resolve the OCMockObject class at linking time.
nick718
 

Re: OCMock on iOS4

Postby IAmEternaL » 25 Jun 2010, 11:24

I was able to get it working again by adding its sources .h/.m files to my project (and therefore to "Compile Sources" build phase). This BTW makes the framework's headers "Copy Files" build phase unneeded. I'm not sure if I used the correct approach I just can't allow myself to spend too much time on this one. So if there is any other way - I will be happy to hear/use it.

UPDATED: it turned out you don't want to remove that framework's headers "Copy Files" after all.
IAmEternaL
 
Posts: 1
Joined: 25 Jun 2010, 11:19

Re: OCMock on iOS4

Postby erik » 20 Jul 2010, 12:59

I am working on adding support for iOS directly into OCMock, using a static library. At the moment there are a couple of problems but I expect that there will be a solution in the next week or so.
erik
 
Posts: 90
Joined: 10 Oct 2009, 15:22
Location: Hamburg, Germany

Re: OCMock on iOS4

Postby rdpfeffer » 23 Jul 2010, 00:13

Thanks for the update Erik. I know my team is looking forward to this as well!
rdpfeffer
 
Posts: 1
Joined: 23 Jul 2010, 00:12

Re: OCMock on iOS4

Postby erik » 23 Jul 2010, 01:39

There is an initial version in Subversion now, including an example of how to use the static library in an iOS project. This does not build a combined, i.e. simulator and device, library yet.

http://svn.mulle-kybernetik.com/OCMock/trunk/

Feedback very welcome.

Update: The version in SVN now does build a combined (device and simulator) library.
erik
 
Posts: 90
Joined: 10 Oct 2009, 15:22
Location: Hamburg, Germany

Re: OCMock on iOS4

Postby Jeremy » 27 Jul 2010, 00:20

I finally got my unit tests working again. I had it mostly going using Erik's static library, but I was getting a lot of "unrecognized selector sent to instance" errors.

It turns out you need to add -OjbC to your Other Linker Flags as well as -force_load $(PROJECT_DIR)/Libraries/libOCMock.a

Documentation of why:
http://developer.apple.com/mac/library/qa/qa2006/qa1490.html

Erik's example project did this, but I didn't know to look for it when trying to modify my existing Xcode project.

Hopefully this helps someone else.
Jeremy
 

Re: OCMock on iOS4

Postby hborders » 04 Aug 2010, 17:03

Can someone that is a compiler/linker nerd explain why the OCMock.framework worked on iPhone3.1 and now doesn't work on iOS4?

Did apple prevent loading shared libs for the simulator too? I thought that would show up at runtime rather than link time.

I'm using the static library just fine, but I'm just curious.

Thanks!
hborders
 
Posts: 3
Joined: 04 Aug 2010, 17:01


Return to OCMock