限制或更改 Xcode 4 中的方案目的地?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5356146/
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
Limit or change Scheme Destinations in Xcode 4?
提问by amrox
Overview & Motivation
概述和动机
I would like to set up some Schemes that build for iOS Device only.
我想设置一些只为 iOS 设备构建的 Schemes。
For example, I never want to build an Ad Hoc build with a Simulator destination. The ability to choose Simulator destinations for an Ad Hoc build is just noise.
例如,我从不想使用 Simulator 目标构建 Ad Hoc 构建。为 Ad Hoc 构建选择模拟器目的地的能力只是噪音。
Desired Behavior
期望的行为
Actual Behavior
实际行为
What I tried
我试过的
- I removed the "iphonesimulator" value in "Support Platforms" in the configurations that are meant to be device-only, like so:
- 我在仅用于设备的配置中删除了“支持平台”中的“iphonesimulator”值,如下所示:
- In the Ad Hoc scheme settings, I disabled the run and profile steps. I left the archive step
- 在 Ad Hoc 方案设置中,我禁用了运行和配置文件步骤。我离开了存档步骤
- For all Build steps (including the disabled ones) I set the Build Configuration to "Ad Hoc", which was previously set to
iphoneos
only.
- 对于所有构建步骤(包括禁用的步骤),我将构建配置设置为“Ad Hoc”,之前
iphoneos
仅设置为“Ad Hoc” 。
Results so far
到目前为止的结果
I can still select Simulator as a destination in the scheme dropdown:
我仍然可以在方案下拉列表中选择模拟器作为目的地:
However, if I run the scheme with a Simulator destination, I get an expected, appropriateerror:
但是,如果我使用 Simulator 目标运行该方案,则会收到预期的适当错误:
It would be much nicer for myself and my team is would could just hide these invalid destinations.
这对我自己来说会好得多,我的团队可以隐藏这些无效的目的地。
Is there a better way to manage what destinations are available for a given scheme?
有没有更好的方法来管理给定方案可用的目的地?
回答by Joshua Nozzi
Updated Answer
更新答案
Hmmm. This works for me with ONE target. I removed the platforms from the Supported Platforms in the configuration and they disappeared from the Scheme.
嗯。这对我有一个目标。我从配置中的支持平台中删除了平台,它们从方案中消失了。
I then tried adding another configuration that allows the simulator and it's still just the device destination visible. Then I duplicated the target and added in iphonesimulator ... and the simulator shows up in the scheme for both targets.
然后我尝试添加另一个允许模拟器的配置,它仍然只是设备目标可见。然后我复制了目标并添加到 iphonesimulator ... 并且模拟器出现在两个目标的方案中。
Unfortunately, I think the available destinations are an aggregated list of those available to all targets. File a bug report: http://bugreporter.apple.com
不幸的是,我认为可用目的地是所有目标可用的目的地的汇总列表。提交错误报告:http: //bugreporter.apple.com
Another Update
另一个更新
AH! It looks like an Xcode bug with updating the Scheme selector! I configured each target's settings - one to omit the simulator and the other to keep it - then closed and re-opened the project. Magically, the first target had only the iOS Device destination while the other target had the device + simulator destinations.
啊!它看起来像是更新 Scheme 选择器的 Xcode 错误!我配置了每个目标的设置 - 一个省略模拟器,另一个保留它 - 然后关闭并重新打开项目。神奇的是,第一个目标只有 iOS 设备目标,而另一个目标有设备 + 模拟器目标。
So, the answer may well be to duplicate your desired targets and set them to allow only the device, then make sure your scheme is properly named so you know which target is being built. Close and re-open the project and the list should show up just as you'd expect.
因此,答案很可能是复制您想要的目标并将它们设置为仅允许设备,然后确保您的方案命名正确,以便您知道正在构建哪个目标。关闭并重新打开项目,列表应该会如您所愿地显示出来。