问题
I know one can rename a project by slowly double clicking the project name but I was wondering if it's possible to automate that through the command line (any language, possibly Apple Script) ?
回答1:
You will have to manipulate the .xcodeproj file, which is in XML format.
In my build process I have placeholder names that I simply search & replace with a command line app. If you need a generic solution you will have to parse the XML format (which is undocumented but not that hard to grasp).
回答2:
Renaming an Xcode4 project is quite easy. Click on Show the Project Manager to see the top level project file on the left side. Click on the project name (here DeeTeeSaver will be changed to DeeTeeSaver2) in order to edit it and enter the new name.
It takes a second to let Xcode4 find out which parts have to be changed. It then displays a dialog which parts will be changed. Simply click on Rename.
That´s it. No need to fondle around with AppleScript. You might miss important parts inside the bundle.
Greetings from Switzerland, Ronald Hofmann
来源:https://stackoverflow.com/questions/7171457/programmatically-rename-an-xcode-project