如何复制我的 xcode 项目?(iPhone SDK)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2235019/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I duplicate my xcode project? (iPhone SDK)
提问by RexOnRoids
How do I duplicate my xcode project? (iPhone SDK)
如何复制我的 xcode 项目?(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.
顺便说一句,我只是复制/重命名了整个项目文件夹。但是当我开始在新的(重复的)项目中工作时(在更改应用程序 ID、配置文件之后),我开始收到有关目标的错误。我不知道目标是什么或任何东西。嗯。希望这有效。
回答by coneybeare
While all the above answers are correct, I believe we should ask WHYyou 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.
虽然上述所有答案都是正确的,但我相信我们应该问你为什么要这样做。如果您想制作应用程序的精简版或具有细微差别的版本,您应该探索复制目标,而不是复制整个项目。
回答by nevan king
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.
只需复制项目所在的文件夹,然后使用副本中的项目文件即可。如果您只是想在尝试一些代码创意之前进行备份,您也可以制作快照。
回答by Adam Eberbach
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.
另一种选择——考虑获得一个免费的源代码控制系统,如 svn、git 或 mercurial(或 perforce 或其他商业系统提供有限使用的免费许可证)*,然后对你的项目做任何你喜欢的事情。如果您不喜欢结果,您可以随时返回到较早的版本。如果你想变得更复杂,你可以分支它。这是您以专业方式工作可以采取的最大步骤之一。
*anything but Visual SourceSafe. Don't use that! CVS is probably best avoided too.
*除了 Visual SourceSafe 之外的任何东西。不要用那个!CVS 也可能最好避免。
回答by Dan Laut
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].
当您在 XCode 中为 iPhone 等设备构建应用程序时,XCode 使用该设备的模拟器并将包放在 ~/[USER]/Library/Application Support[SIMULATOR]/[ 下用户库中的模拟器文件夹中版本]/应用程序/[UID]。对于 IOS 6 下的 iPhone,它将在 ~/[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.
看起来像 061A54D9-2D96-4BE2-8C58-A8115A15ADA2 的 UID(唯一标识符)就是问题所在,因为项目头文件([PROJECT NAME].xcodeproj 包中的 project.pbxproj)引用了它。
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.
如果你将你的项目复制到另一个卷并在那里构建它,将生成一个新的 UID,但 project.pbxproj 仍将使用旧的 UID 进行引用,并且将无法找到模拟器的资源,例如故事板和图形。
Replace the new UID with the old one and things should be fine.
用旧的 UID 替换新的 UID,事情应该没问题。
回答by Dan Laut
You should be able to copy-and-paste your project directory to another folder without any issues.
您应该能够将项目目录复制并粘贴到另一个文件夹中而不会出现任何问题。