OCMock Update

The website for OCMock, a framework dear to my heart, has received a big facelift! It’s much cleaner and easier to use than ever.  They now publish their GitHub link on the download page–which makes installation a snap if you’re using Git.

If you like including third-party frameworks in your apps it is so easy with Git submodules.   e.g.:

cd path/to/my-git-repo
git submodule add git@github.com:erikdoe/ocmock.git
git commit -a -m "added ocmock submodule"

Now you’re ready to integrate the third party source into your project. Refer to the installation instructions for that source (eg: OCMock iOS installation).

If this is too much to swallow, you can always try CocoaPods. I’m not a fan because it requires mucking with Xcode workspace files–and I think it is more difficult to configure to use private repositories.  I find submodules easier to use with build servers, as it works out of the box. CocoaPods requires installing and configuring another tool.

Anyhow, go install the third party framework, commit your project changes and start coding!

Also, if you need to clone your repository you’ll need to initialize the submodules afterward. Git doesn’t automatically go out and fetch the submodules during a clone operation.

git clone me@github.com:me/my-git-repo
cd my-git-repo
git submodule init           <-- initialize submodules
git submodule update         <-- make sure they're checked out

Lastly, if you need more info about git submodules there’s lot of info on the interwebz.

One thought on “OCMock Update

  1. If you incorporate OCMock be sure to use the -all_load linker flag. If you use -force_load you must specify the name of the library to force load. Otherwise you may get a cryptic linker error like I did:

    ld: file not found: -fobjc-arc
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

Comments are closed.