为 Xcode 项目设置默认方案
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12943477/
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
Set the default scheme for Xcode project
提问by rooftop
I have an Xcode project MyApp (with 1 target MyApp), that includes another project LibProject (with 2 targets, lib and app). I have autocreate schemes selected in the Xcode ui, and when I first open the project it does indeed create the schemes but one of the schemes from the nested LibProject is selected whereas I want the single target/scheme from MyApp to be selected. I can change the scheme after the fact and the UI remembers, but I don't want to have Xcode default to an incorrect scheme.
我有一个 Xcode 项目 MyApp(有 1 个目标 MyApp),其中包括另一个项目 LibProject(有 2 个目标,lib 和 app)。我在 Xcode ui 中选择了自动创建方案,当我第一次打开项目时,它确实创建了方案,但选择了嵌套 LibProject 中的一个方案,而我希望选择 MyApp 中的单个目标/方案。我可以事后更改方案并且 UI 会记住,但我不想让 Xcode 默认为不正确的方案。
The order the schemes end up:
计划最终的顺序:
lib (*with this one selected)
app
MyApp
Any idea how to select the default for newly created schemes?
知道如何为新创建的方案选择默认值吗?
回答by Simon H
I had exactly this problem. We have three projects in one workspace, one of which is dependent on the other two. To build everything, we build the main project, but, somewhat, but not provably, around the time we switched to Xcode 6, the scheme which came up when we pulled would be one of the subsidiary projects. Even if we changed it to the main project, it would revert with every pull from git. So, I knew that this was not a user setting which controlled it, but something hidden in a common file, since our user settings file are not in our git repo.
我正是有这个问题。我们在一个工作区中有三个项目,其中一个依赖于另外两个。为了构建所有东西,我们构建了主项目,但是,在我们切换到 Xcode 6 的时候,在某种程度上,但无法证明,我们拉动时出现的方案将是附属项目之一。即使我们将其更改为主项目,它也会在每次从 git 中拉取时恢复。所以,我知道这不是控制它的用户设置,而是隐藏在公共文件中的东西,因为我们的用户设置文件不在我们的 git 存储库中。
I managed to change it back for our workspace. I did three things:-
我设法将它改回我们的工作区。我做了三件事:-
Firstly I reordered some file in the main project, just in case it was some hidden project setting, but that did not work;
首先我在主项目中重新排序了一些文件,以防万一它是一些隐藏的项目设置,但这不起作用;
Then I noticed that the top-level project was set to build in parallel, so I set that to not do so, since it does require the output of the other two projects to link. Xcode actually manages this fine, but it was a way to force a change in the scheme file. This did not appear to fix it either;
然后我注意到顶级项目被设置为并行构建,所以我将其设置为不这样做,因为它确实需要链接其他两个项目的输出。Xcode 实际上管理得很好,但它是一种强制更改方案文件的方法。这似乎也没有解决它;
My third change was to delete and re-add the subsidiary projects in the workspace; I also reversed the order of the two subsidiary projects. This final change did make the main project's scheme appear for other users, so I believe is the way to do it.
我的第三个变化是删除并重新添加工作区中的子项目;我还颠倒了两个子项目的顺序。这个最终的改变确实让主要项目的方案出现在其他用户面前,所以我相信这是这样做的方法。
I listed the other items in case it turns out that this is not just one step and I got lucky due to the earlier attempts.
我列出了其他项目,以防万一事实证明这不仅仅是一步,而且由于早期的尝试,我很幸运。
回答by wigging
Have you tried the the Edit Scheme... or New Scheme... or Manage Schemes... in the Product menu of Xcode. You should be able to edit the scheme to what you want and Xcode will remember it for the project.
您是否尝试过 Xcode 产品菜单中的 Edit Scheme... 或 New Scheme... 或 Manage Schemes... 。您应该能够将方案编辑为您想要的,并且 Xcode 会为项目记住它。