I'm looking for a way to dynamically add in information about the application during the build process of an iOS application.
During testing, it would be great to know when the application I have installed on my device was built and possibly who built it would be a good to know as well.
I'm envisioning a section in settings.app that would give basic build information for debugging purposes. I don't want to have to manually update a build information file before each build - the data should be generated dynamically.
You can write a shell script build phase in Xcode that runs at the end of your build process. In this phase you can use the defaults
command to write data to an arbitrary file. I've used this technique to write to the Info.plist file, but you can write to any file you want[1].
Here's a sample script to write the current git version to Info.plist:
infoplist="$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH"
gitversion="$(cd "$SRCROOT" && git describe --always --dirty 2>/dev/null)"
if [[ -n "$gitversion" ]]; then
defaults write "${infoplist%.plist}" GitVersion "$gitversion"
fi
You should be able to adapt this to point to the file you want (e.g. your Settings bundle) and write the info you want.
[1] Be careful if you write to Info.plist, Xcode has bugs that can prevent it from realizing Info.plist changed during the build, which can break the provisioning when doing a device build.
You can also use standard macro __DATE__
which will result string like "Jun 25 1980" of course with proper current date of build.