How do I run a preferred target in Xcode?
Asked Answered
T

2

11

I'm studying a simple application demo from Apple that has two (2) targets.
Each target has its own plist, storyboard and some code; with a few files shared between them.

Choosing the 'R'un, runs one default target. I want to specify what target to run.

How do I select the target to run in Xcode?

enter image description here

Tortious answered 3/4, 2015 at 17:59 Comment(0)
P
14

If you have more than one app target, you have more than one scheme. If you have more than one scheme, you can pick a scheme from the scheme menu (at the top of the project window). Then when you run, that scheme will be what builds and runs (on the corresponding destination).

In this screen shot, I have two app targets and hence two schemes ("backgroundPlayer" and "interrupter"):

enter image description here

As you can see, "backgroundPlayer" is checked. So if I build and run now, I build and run "backgroundPlayer". But if I choose "interrupter", then it will be checked, so if I then build and run, I build and run "interrupter".

Puparium answered 3/4, 2015 at 20:21 Comment(2)
Spot on. So simple. Thanks!Tortious
No problem. You might want to read the section of my book explaining what a scheme is: apeth.com/iOSBook/ch06.html#_schemes_and_destinationsPuparium
H
-1

Every target has 0 or more schemas

Xcode v10

Product -> Scheme -> Choose Scheme
//or
control + 0
//or
click on the active scheme

Here you can manage your schemas

[Xcode project structure]

Harv answered 18/7, 2020 at 18:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.