Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limit or change Scheme Destinations in Xcode 4?

Tags:

xcode

ios

xcode4

Overview & Motivation

I would like to set up some Schemes that build for iOS Device only.

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.

Desired Behavior

Desired - only iOS Device

Actual Behavior

Actual

What I tried

  • I removed the "iphonesimulator" value in "Support Platforms" in the configurations that are meant to be device-only, like so:

Configuration Support Platforms

  • In the Ad Hoc scheme settings, I disabled the run and profile steps. I left the archive step

steps

  • For all Build steps (including the disabled ones) I set the Build Configuration to "Ad Hoc", which was previously set to iphoneos only.

Results so far

I can still select Simulator as a destination in the scheme dropdown:

Simulator still availabke

However, if I run the scheme with a Simulator destination, I get an expected, appropriate error:

The selected run destination is not valid for this action.

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?

like image 916
amrox Avatar asked Mar 18 '11 18:03

amrox


1 Answers

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.

Unfortunately, I think the available destinations are an aggregated list of those available to all targets. File a bug report: 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.

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.

like image 195
Joshua Nozzi Avatar answered Oct 03 '22 11:10

Joshua Nozzi