Duplicating xcode projects
I am trying to duplicate an xcode project for an app that is virtually identical but still has differences in a handful of source files and some data files. For开发者_Go百科 the most part this seems to work, but I am having an issue where, after I build project 2, then project 1, I notice that running project 2 runs with files from project 1. I need to touch the distinct files in project 2 to get them to built in proj 2. Does anyone know what I have to do to have them recognize their own files properly?
I first suspected that it was some sort of object file issue where file.m in proj 1 would be built and confuse file.m in proj 2 into thinking it was up to date. Looking in their config, the dirs for intermediate build files are different, though so maybe I'm looking at the wrong setting or the problem is elsewhere? The two projects use files of the same name but from different subdirectories.
Here is how to locate the missing (red) files using the new Xcode 4 interface: 1) select the file or files in the left hand Project Navigator (the folder icon); 2. In the right sidebar click on "File Inspector" which is the leftmost icon resembling a page; 3. In the "Identity and Type" section, there is a grey box labeled "Location". Click on the small icon to the lower left that resembles a file browser - this will come up with a file browser to locate the file. Voila, you are done.
Unless you set it up differently, Xcode should use the location of folder the project file -- *.xcodeproj -- is in as a basis for referencing its files. Are your .xcodeproj files in different subdirectories, too? If you ensure that the project file and all of the files it references are in completely different directories you should be set.
If you've done that and it's still a problem you can manually re-reference them. Right-click on a file (or the group it's in) and choose Get Info. Then click the Choose button on the right side of the Path entry in the info window, and show Xcode where it should look for that file. Before closing the info window change the Path Type to relative to project.
If the file name turns red in Xcode it means that it doesn't see the file in the location you just specified, so copy it there in the Finder. The red text should turn to black and you'll be set.
Do this with all of the files in each project and there can be no mistake on Xcode's part after that.
精彩评论