I wrote an implementation based on the answer provided by gagarwal. I added this build script to my build steps before the compilation step:
/usr/libexec/PlistBuddy -c "Set :GIT_COMMIT_HASH `git rev-parse HEAD`" "${TARGET_BUILD_DIR}"/"${INFOPLIST_PATH}"
In my code, I reference it by calling:
[[NSBundle mainBundle] infoDictionary][@"GIT_COMMIT_HASH"];
And voila, your last hash value is available at runtime!
source share