iPhone development: how to rename a project in XCode 3.1

Dec. 9th, 2008 12:06 by Stéphane de LucaPermalink | TrackBack: https://stephanedeluca.com/trackback/847 — updated on Dec. 16th, 2008 13:04 exists for 15 years & 5 months ago

Programming a new system or platform always makes you start from existing code snipets or even sample project for you to experiment with.
As you put much and much time on it, you often end up with a project that does not have to do any longer with the original sample. And you probably want to somewhat rename it with your final app. So here we go, here is a small process to do that with xcode projects version 3.1 -- but surely works with different version.

All the steps:

  1. quit xcode
  2. rename the old folder to the new name -- in this example say oldproject to be renamed to newproject, do that straight from the finder
  3. still with the finder, get to the folder newproject and rename the files oldproject.xcodeproj and oldproject_Prefix.pch to newproject.xcodeproj and newproject_Prefix.pch respectively
  4. delete the folder build
  5. run xcode and open newproject.xcodeproject
  6. open the window Project|EditPoject Settings and clik on the Build tab
  7. find the Product name from the list -- it appears in bold, and edit with the value: newproject -- note that it might be originally empty tough
  8. take textmate and load the file *project.pbxcode" from the file newproject.xcodeproj which is actually is a folder
  9. search for the string "oldproject". Do that manually please, don't use the the replace option form textmate.
  10. any time you find oldproject just retype newproject on it. There is an execption though. It is useless to change the delegate names such as oldprojectappdelegate. But as you probably want to to so, you'll do that eventually straight form xcode itself.
  11. save this file and swtich back to xcode.
  12. xcode asks for refrshing the project.pbxcode, just tell yes.
  13. clean all targets and build and go.
  14. everything works with no hassles.
  15. last optional step: use xcode to rename all delegates files -- don't forget to do that in the related code and classes.