There are lots of howtos, but none of them really did the job for me. So here’s how I do it (I assume you want to reneme OldProject to NewProject):
- Backup!
- Rename the OldProject.xcodeproject, and the folder it is in.
- Inspect the contents of your OldProject.xcodeproject (”Show Package Contents” in finder), there should be a file project.pbxproj. Edit that in your text editor. I used Emacs, but I guess you should be fine with any decent editor that repects the character encoding. Close the project before editing, or make sure your editor auto-loads changed files.
- In project.pbxproj, replace some occurrences of your old project name with your new one. Don’t replace anything in comments, and no filename replacements (like OldProject.m). Some important locations are OldProject.app (there should be one occurrence where it’s not in a comment) and some constructs with “path”, “PBXProject”, “PBXNativeTarget”, “PRODUCT_NAME”, “productName”, “name”.
- Test loading, building and running the project. It should work as before and feature your new project name in the relevant locations (e.g. it should be NewProject.app now). If xcode complains about corruption it might be because you ignored character encoding or didn’t hit all locations of OldProject.
- Optional: As soon as your project is working as before, you can rename all your source files that have OldProject in their name and all references (like #import and the like). This might take some time in a large project.
- Optional: If you renamed your source files, your xibs will probably be wrong too. Correct all references to OldProject until your app is running smoothly again. Also check your code if you’re using “initWithNibName”.
- Done! You should probably test your app thoroughly, especially if you’re lazy-loading views and the like. They could still be erroneous references to OldProject classes.
I hope that helps. I know it sounds like a lot but it should be feasible in about 5 minutes, without the optional source file renaming which could take quite a while in a large project. Again, backup!
Tags: iphone, xcode
March 17th, 2009 at 4:37 pm
Uberdose great to see your updating your blog again. Obviously Xcode is a Mac os2 app for programming and I think you are doing something with iphones in that regard. I read your blog from time to time and all I can say is your are really techy and I do not understand everything you write but the things I do are quite interesting. If your next project will be as successful as all in one then I think you will go far.
May 12th, 2009 at 9:02 pm
Thanks. This saved me a lot of time.