How do I duplicate my xcode project? (iPhone SDK)

2020-05-23 15:40发布

问题:

How do I duplicate my xcode project? (iPhone SDK)

By the way, I simply duplicated/renamed the entire project folder. But when I started working in the new (duplicated) project (after changing app ids, provisioning profiles) I started getting errors about targets. I have no clue about what targets are or anything either so. Hmmm. Hope this works.

回答1:

While all the above answers are correct, I believe we should ask WHY you are doing this. If you want to make a lite version of your app or a version with a subtle difference, you should explore duplicating targets, not duplicating entire projects.



回答2:

Just make a copy of the folder your project is in, then use the project file from your copy. You can also make a snapshot, if you're just looking to backup before you try some code ideas.



回答3:

An alternative - consider getting a free source control system like svn, git or mercurial (or perforce or other commercial systems offer free licenses for limited use)* and then do anything you like to your project. You can always go back to an earlier version if you don't like the results. If you want to get more complicated you can branch it. This is one of the biggest steps you can take towards working in a professional manner.

*anything but Visual SourceSafe. Don't use that! CVS is probably best avoided too.



回答4:

When you build an app in XCode for a device such as the iPhone, XCode uses a simulator for the device and puts the package in the simulater folder in the user library under ~/[USER]/Library/Application Support[SIMULATOR]/[VERSION]/Applications/[UID]. For the iPhone under IOS 6 it would be in ~/[USER]/Library/Application Support/iPhone Simulator/6.0/Applications/[UID].

The UID (Uniqe Identifier), which looks like 061A54D9-2D96-4BE2-8C58-A8115A15ADA2, is where the problem is, because the project header file (project.pbxproj in the [PROJECT NAME].xcodeproj package) references it.

If you copy your project to another volume ad build it there, a new UID will be generated, but project.pbxproj will still use the old UID for referencing and it will not be able to find the resources for the simulator, such as the storyboard and the graphics.

Replace the new UID with the old one and things should be fine.



回答5:

You should be able to copy-and-paste your project directory to another folder without any issues.