« previous: How To Access A VNC Remote Desktop After The Server Reboots | next: MySQL: Drop Multiple Tables From a Database »
When you’re using Xcode to develop an iPhone app or a Mac app, you might decide that you need to rename your project. In many cases this would mean not only renaming the actual executable file that gets produced, but also the names of various source code files, project folders, and the contents of various files within the project.
As far as I can tell, Xcode provides no way to do this. There are a few settings that seem like they might do part of it, but every time I tried to use one of them within Xcode, it just resulted in errors and my project failing to build. After many hours and much frustration with Xcode, I decided to try it the Unix way, and it worked. The solution is a straightforward 3-step process:
1. First I closed Xcode, and made a backup of my project folder. Then I went into my project folder and renamed every file and folder which contained "OldName" so that it now contained "NewName" instead. This could be scripted pretty easily but my current project is a small one so I spent the ~5 minutes to manually rename the files and folders.
2. In the project folder, I ran the following command in a terminal, to update the contents of the files in the project:
find . -type f -exec sed -i 's/OldName/NewName/g' "{}" \;
3. I opened the now-renamed project in Xcode and clicked Build -> Clean All Targets.
After that, the project (with the new name) built successfully.