views:

1057

answers:

3

I'm an independent developer working primarily with iPhone applications, and I'm currently engaged in several different projects. Some are for myself, and others are for one of a number of clients. Because of this, I'd like to have a way to have Xcode set the copyright notice at the top of each source file on a per-project basis.

I've seen these questions, and I understand that Xcode by default pulls the organization on the user's Address Book contact card for the copyright statement, and that you can change the property either in the Address Book or on the terminal. What I'm looking for is a setting that lets that default be changed for each project, and has Xcode remember the copyright assignee (i.e. I don't want to have to change my Address Book organization entry each time I switch projects).

+2  A: 

You can change the organization Xcode currently uses by issuing the following command in Terminal:

defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions '{ORGANIZATIONNAME = "Some Company Name"; }'

You can then create scripts that switch the current company for Xcode.

Diederik Hoogenboom
Can you be more specific? Where would I place these scripts? How would I trigger them to run? I'd really like a system that's as painless as possible - running a script before each project switch is almost as bad as typing the command myself each time.
Tim
You could add the command as a build script so it will be dependent on your Xcode project file. But then you first have to build the project before adding any new files which might not be what you want.
Diederik Hoogenboom
Thanks, this Command makes the work pretty easy.
iPhoney
+1  A: 

You might want to make custom templates. Have a look at this question: http://stackoverflow.com/questions/33720

Richard Hoskins
This is a lot closer to what I'm looking for, thanks!
Tim
+2  A: 

Upgrade to Xcode 3.2, which now has a project setting for organization name. See http://iphonedevelopertips.com/xcode/change-company-name-from-within-xcode-on-a-per-project-basis.html