After reading the first 6 chapters in Aarons book, I couldn’t wait any longer and had to start writing my own program. I will share a first taste of it here soon. One key problem I soon faced was how to manage multiple versions, i.e., how to save old versions of my program when making major changes. Xcode has no rename functionality, and since an Xcode project comprises many files, the answer is not straightforward. A related problem is that I first started to call my Cocoa Application project by appending the version number. The problem with that is that the Cocoa application by default has the same name and that was awkward. For instance, my current project, a fractal generator, is called “FracGen 0p3”, but I wanted the application to be called only “FracGen” and have the version number appear when selecting the “About” menu item.
To rename an Xcode 2.5 project, do the following:
- Close the project in Xcode
- Duplicate the project directory in the Finder by pressing Command-D.
- Rename the folder
- Open the folder and rename the “.xcodeproject” file
- Delete the “Build” sub folder, if there is one
- Open the renamed .xcodeproject file
- On the left in the “Groups&Files” list, expand the “Targets” group, double click on the target that still has your old project filename. Rename it under the “General”-tab in the window that opens.
- Select “Clean all targets” from the “Build” menu, keep the boxes checked, and click “Clean”.
- Build and run your project.
Now about the second problem:
- In Xcode, on the left in the “Groups&Files” list, expand the “Resources” group, and click on “Info.plist”. In the editor on the right you’ll see a lot of entries of this plist file.
- Go down to the “CFBundleVersion”-entry and enter your version number, e.g., “0.3”
- Next, on the left select “InfoPlist.strings”. In the editor on the right, you’ll see an entry for “NSHumanReadableCopyright”. Enter your information between the quotes, e.g., “(c) Toby Junker, 2008”
- Finally, double-click your target (the one you renamed above), select the “Build”-tab in the window that opens, and scroll down until you find “Product Name”. This will have the original name of your “Xcode Project” (before you renamed it). Choose a name w/o version number, e.g., “FracGen”. You will not have to change this again.
These steps sound rather daunting, but are actually very quick to do. I have not yet switched to Leopard, so I don’t know if they work in Xcode 3.0, of if Xcode 3.0 finally has a rename function. The steps given to rename a project have to be executed every time you want to create a new version of your project. The application name and copyright info has to be changed only once. if you want the version to show up correctly in the application’s “About” box, you’ll have to change the plist as explained above.
Pingback: (X)Code Sharing: The Sunday Programmer Guide - OOgtech.org