If you don’t have someone that you’re collaborating with in your software project, this post does not apply to you. But then again, if you’re writing software and you’re doing it by yourself, your probably should find someone. You can only lay so many bricks in your lifetime. So go get yourself a teammate and come back to read this one.
Though zipping up your file and passing it back and forth with Gmail between your team member does the job, there are much better ways to collaborate. Among the most popular are CVS and SVN. My recommendation is that you set yourself up at www.assembla.com. (Their recent controversial bait-n-switch move will have to be discussed at a later time). It’ll cost you $2 bucks a month/per project. Dudes, there are more money under your couch so spare me the whining about the costs. I’ve been using assembla.com and the SVN service alone is worth the cost.
Before going on, there seems to be myths floating around about Xcode’s SCM. Here are some:
- it doesn’t work
- it sucks
- its buggy
My partner is gonna hate me for saying this since he is one of those people that believes that SCM sucks, but I hereby declare that SCM works, and it works just fine. At least with SVN anyway.
So, on to getting SVN set up with SCM then.
Step 0: Create a project. If you already have a project you want to import into SVN then by pass this step. Otherwise, let’s create a dummy project for this tutorial. Go to File->New Project, then click on Applications under iPhone OS from the left side panel. Click on View-Based Application then the Choose button. Type in the name of your project folder and click on Save. (I chose ‘Sandbox’)
Step 1: Set up your SVN repostiory and get its URL. This is simply a matter of cut-n-pasting the URL of the repository. Go to Preferences from the Xcode menu and click on the SCM icon on top. To add your repository click on the ‘+’ icon on the left bottom side and give your repository a name. Cut and paste the URL of your SVN repository into the URL field. The rest of the fields should be automatically filled in by Xcode except username and password. Type the username and password in, and your setup screen should look something like this:

Step 2: Import your project. Navigate to SCM->Repositories. You should see your repository you just set up on the left side panel. If you already have files checked in, you should see them when you click on your repository. Click on Import, and simply select your project folder, then click on Import button. Voila, now your code is in the repository.

Step 3: Check out your project. Huh? Why do we have to import a project we just checked in? This is the part that confuses a lot of people. If you are familiar with how SVN works, this might not come as a surprise to you, but once exported, we’re not going to deal with the local copy of the project any longer. You can even delete it if you wish. It’s even possible to check out your project back into your local copy, but we’ll just check out the code into another folder for the sake of sanity. Click on SCM->Repositories, then the Checkout button. Type in ‘Sandbox SVN’ as your project name and check out the project. You’ll be prompted to open the project, open the project.

Step 4: Configure your project to your repository. We’re not done yet, we still need to let SCM know which repository we want to check our code into. This step might seem redundant but if you have multiple repositories you’re working with then it could come in handy. Anyways, navigate to SCM->Configure SCM For This Project. At the bottom of the window you’ll see a drop down menu labelled ‘SCM Repositories.’ Choose your repository, and you’re done!
As you edit your code and add files to your code, you’ll see letters appear besides the files you edit. The letters you see next to you folders/files mean the following:
U - The code in SVN has been changed and thus your local copy needs to be updated.
M - This letter indicates that the file has been modified locally.
C - There is conflict with your code and the code in the repository.
A - Files you’ve added but have not been checked into SVN. They’ll be commited on your next commit.
A few gotchas you have to look out for:
- Remove build folder if it was checked in. This will not only cause build problems when you try to build someone else’s code, but Xcode will complain when you try to Update or check in code:

- Refresh your project. Refreshing your project lets your know what you’ve changed and also what has changed in SVN. This is pretty useful if you do this right before you check in code or update your project.
If you enjoyed this post, make sure you subscribe to my RSS feed!
Tutorials
assembla.com, collaboration, cvs, iPhone Development, iphone svn, iphone tutorial, scm, source control, svn, versioning, Xcode