Using Xcode 4.5.2
Sometimes I want to rename a project throughout the project without leaving the obvious folder names from previous versions in the project file system.
The usual instructions for renaming an Xcode project do not. I read them and made them many times. They only go that far. They leave the main directory (at the same level as the .xcode.proj file) with the project name ORIGINAL. Call me piercing, but I don't like it. Therefore, I try to change it as follows.
First, I start with the usual instructions, then try to rename the remaining original folder name in both Xcode and Finder. It ends badly. Here are the steps that I am following. It must be reproducible.
We will try to change the project with the name "JoeSchmoe" to "JoeSchmoe_1".
Follow the normal procedure for renaming a project.
- Create a new Xcode utility project called "JoeSchmoe". Use storyboards and ARC.
- Build, run, and test to make sure everything is in order. It. Stop.
- Hit cmd-shift-J
- Open the Utilities panel on the right.
- In the "Identification" section, change the project name to "JoeSchmoe_1". Xcode asks you: "Rename content project elements?" Click Rename
- Build. It must be successful. And indeed it is.
Problem
- In the Project Navigator, note that the main folder in the project is still called "JoeSchmoe"!
- Change the name of this folder to JoeSchmoe_1
- Build. It must be successful. And so it is. We are done, right? Take a good look at the project file system.
Quit Xcode
In Finder, open the folder containing the recently renamed and running "JoeSchmoe_1.xcode.proj", (Its containing folder is still called "JoeSchmoe", now it's fine. We can change it to anything without affecting Xcode if it contains a file .xcode.proj and its related files and directories. We leave this alone.)
In this directory (at the same level as the JoeSchmoe_1.xcode.proj file), note that the main project folder is also still called "JoeSchmoe" !!
Change the name of this folder "JoeSchmoe" to "JoeSchmoe_1". (We expect this to break the project, because we know that Xcode will still look for the JoeSchmoe folder, because it did not change it for us.)
Run xcode
- Build. It does not work as expected.
Please note that all file names in Project Navigator are now red, that is, no files were found. (We expected this. Now we want to fix it.)
In the Project Navigator, select the project (top icon), then Target → Build Settings → Packaging → Info.plist File.
Please note that the path to the file in the settings line of the Info.plist file is called: JoeSchmoe / JoeSchmoe_1-Info.plist !! There is still an old project name in the catalog. But in the file system, we just changed it. So do it the same way as in the file system.
Change its name to JoeSchmoe_1 / JoeSchmoe_1-Info.plist
Recheck that the directory_name / file names are identical in the file system and that you have it in the Xcode Packaging → Info.plist settings.
If they are, the project should be built. Right?
He does not work. And all the project files are red (this means that they were not found).
Try to clear the project (product menu → Clear),
Close Xcode, reboot and create.
- It does not work as before.
At this point, I have no theory about why it fails, except that it is assumed that there is an Xcode parameter that needs to be changed somewhere that I have not yet discovered. Looked around. I'm at a dead end.
What am I missing?
source share