Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

grandM

macrumors 68000
Original poster
Oct 14, 2013
1,551
309
Hi Guys

I'm trying to do something but it keeps failing. I have a working project. I want to hold on to this project A. Nevertheless I want a new project B to make some adjustments to project A. So I duplicated the project A in finder and opened the .xcodeproj file in my finder. It opens up but then the trouble starts.

I can type in new code. Upon running B nothing is changed. Apparantly project A makes the same changes. When I hit the run button over there the project runs. However this wasn't my intention.

I want two independent projects. How can I achieve this goal in an easy way?

Once again: THANKS.
ps: apparantly I can use snapshots but I do wonder how the copying is done
 
Last edited:
I don't have Xcode 6 live on anything at hand, so some of the following may require you to post screenshots or give verbatim lists.

First, review this info:
https://developer.apple.com/library....html#//apple_ref/doc/uid/TP40009934-CH22-SW1

Second, open the original project (Proj-A) in Xcode. Select one of its files in the Navigator, and show its properties in the File Inspector. Tell us what the popup next to "Location" says, and what its Full Path is.

Third, do the same thing for the same file in Proj-B (the duplicate). If both Proj-A and Proj-B have the same Full Path for the file, then that's the problem. There may be other problems, too, such as the two projects having the same "Derived" files location, i.e. the intermediate object files (.o) and such.

If the Location popup shows something like "Absolute Path", then change it to one of the Relative options. You'll have to review the options and maybe experiment.

If you don't want to experiment on Proj-A or Proj-B, then create a new throwaway project containing a single source file (helloworld.c). Change how Xcode refers to the source file. Then duplicate the project and see if it still refers to the original source.

The goal is simply to learn how Xcode manages references to files in a project. Sometimes it's safest to learn how Xcode works on something you don't care about losing.

In earlier Xcode versions, you could choose the "reference type" for any file in the project. You could also change the reference type for any file (or selected sets of files) quite easily. One of the options was "Relative to Project", which means relative to the .xcodeproj file. Since the typical starting point was to put a project file into a new folder for the project, simply duplicating the containing folder (i.e. the folder containing the .xcodeproj) would create a separate duplicate project.
 
Last edited:
What I do to be safe (in addition to checking stuff into a source control repository):

Copy the entire folder containing source code, assets, and project file to another drive, then take that drive offline.

Then change the bundle ID of the new clone project to something different before editing, building or running it.
 
Hi Guys

I'm trying to do something but it keeps failing. I have a working project. I want to hold on to this project A. Nevertheless I want a new project B to make some adjustments to project A. So I duplicated the project A in finder and opened the .xcodeproj file in my finder. It opens up but then the trouble starts.

I can type in new code. Upon running B nothing is changed. Apparantly project A makes the same changes. When I hit the run button over there the project runs. However this wasn't my intention.

I want two independent projects. How can I achieve this goal in an easy way?

Once again: THANKS.
ps: apparantly I can use snapshots but I do wonder how the copying is done


Check the paths for your files. You might have used absolute paths, which means the project refers to files in their original location. Rename the folder containing the original project. Does the project still work? If not then you have used absolute paths, which is an absolute no-no.

Learn to use git. You don't have to store it remotely (e.g. github). You can keep it all locally.

Please explain how git is supposed to help here.
 
Last edited:
Learn to use git. You don't have to store it remotely (e.g. github). You can keep it all locally.
 
Check the paths for your files. You might have used absolute paths, which means the project refers to files in their original location. Rename the folder containing the original project. Does the project still work? If not then you have used absolute paths, which is an absolute no-no.



Please explain how git is supposed to help here.
I checked in the file inspector as Chown suggested. It seems it's absolute indeed. However I cannot changed it. When was this set to absolute? How can this be fixed?
 
Hi Guys

I'm trying to do something but it keeps failing. I have a working project. I want to hold on to this project A. Nevertheless I want a new project B to make some adjustments to project A. So I duplicated the project A in finder and opened the .xcodeproj file in my finder. It opens up but then the trouble starts.

I can type in new code. Upon running B nothing is changed. Apparantly project A makes the same changes. When I hit the run button over there the project runs. However this wasn't my intention.

I want two independent projects. How can I achieve this goal in an easy way?

Once again: THANKS.
ps: apparantly I can use snapshots but I do wonder how the copying is done
[doublepost=1458932978][/doublepost]Hi,

Have you achieved this making of separate new xcode project without making any changes to the original?

I'm in a need to making copy of the existing xcode project to a new project?

Thanks in advance for your suggestions
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.