Kyle Fuller

Migrating from OCUnit to XCTest

You might think you were in luck when Xcode offered you an option to migrate to XCTest, but shortly after trying you will discover that this isn't a true migration. Xcode will only migrate your code, it will not update your project to be testable with XCTest. There are still some steps left and unfortunately Apple have not shared any documentation on how to do this.

Note

I have later discovered that it does work as expected, but only if you run the conversion from a project directly. If you try running the conversion from a workspace you will get the problems mentioned above. I have filed this as rdar://16581037 so Apple can fix this in the future. For now, you'll need to follow the below steps.


OCUnit is deprecated, Convert to XCTest


You can follow these steps to migrate your project to XCTest once you've migrated the code with the automatic converter:

Read more →

Memory Management with ARC

This blog post accompanies a talk I recently gave at NSLondon, you can find the slides for this talk here. There will also be a video version of this out shortly, I will post a link once it's out on my Twitter.

ARC is a very powerful feature introduced in Xcode in 4.0, along with various run-time enhancements. With the introduction of ARC, a lot has changed under the hood. The Objective-C run-time has a completely new interface for using many of the old concepts such as autorelease ...

Read more →

Versioning with Xcode and git

Wouldn't it be great if your iOS or OS X projects just take their version and build number automatically from git? Well, it can!

Using a script in your build phase, you can run a shell to determine the version number and inject this into the Info.plist of a build. It will never modify your local project, just the created build.

GIT_RELEASE_VERSION=$(git describe --tags --always --dirty)
COMMITS=$(git rev-list HEAD | wc -l)
COMMITS=$(($COMMITS))
defaults write "${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH%.*}" "CFBundleShortVersionString" "${GIT_RELEASE_VERSION#*v}"
defaults write "${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH%.*}" "CFBundleVersion" "${COMMITS}"

Read more →