Using subversion to check in apps

10 August 2009 by Chris

We came across an interesting problem whilst trying to build an app with ad-hoc distribution for testing.

We use subversion for version control and as a central storage for all our source code and general documents etc. and using Versions as our tool to check out files (Versions is awesome by the way!) We were building an app on the mac that had the distribution profile installed and putting it on an iPhone. Things worked fine.

The problem came when we were then checking the .app file into the respository, checking it out on another mac and trying to install on another iPhone using iTunes. iTunes kept showing the message "An unexpected error has occurred".

We were stumped for a good few hours assuming this was something to do with the certificate signing until one of us had a brainstorm - .app files are like folders and so subversion was treating them as such and placing a .svn hidden directory within it. This was screwing with iTunes and so it would refuse to install the application.

The solution was to use .ipa files - basically a zip file with a certain structure that iTunes understands as an application. To create an ipa file do the following...

1. Create a folder called payload and place your app file in it.

2. Zip the folder

3. Rename the file with the name of your application and give it an ipa extension.

Subversion will treat these as a single file (just like it does any other zip file) and so these are left intact. Once we did this the application installed correctly on whatever machine checked the file out.