Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build target randomly added to Xcode scheme

I am developing an iPhone app using Xcode 5 and CocoaPods. I have a scheme and target called Oahu that I run my tests against. Accordingly, I am not surprised to see my two test targets present to be built in the scheme's build phase. However, there is a fourth build target that cannot be removed:

enter image description here

When I run tests, all four targets are built, and the test targets are run against the last, incorrect one, Ku.

And after closing Xcode, deleting the contents of the DerivedData directory, and deleting all the *userdata files in my project directory (find ./ | grep userdata | xargs rm -rf), I still have an extraneous build target:

enter image description here

Notice that it now included my Production target and I also had unchecked Find Implicit Dependencies.

I've looked through all my build settings, Oahu.xcscheme, and project.pbxproj, but I can't find anything that would leave to this behavior. Unchecking the scheme's Build Option Find Implicit Dependencies has no effect.

This Oahu scheme is the only one that has this problem – the Ku and Production schemes only have their corresponding targets – though if I duplicate the Oahu scheme, it also has this problem.

Can this be fixed?

like image 614
pr1001 Avatar asked Jun 11 '14 17:06

pr1001


People also ask

What is difference between scheme and target in Xcode?

A Target specifies a product to build and contains the instructions for building the product from a set of files in a project or workspace. An Xcode scheme defines a collection of targets to build, a configuration to use when building, and a collection of tests to execute.

What does Xcode automatically create for each target when a new project is created?

When you embed a new target inside an app, Xcode creates a dependency between the app and target if the scheme's Find Implicit Dependencies option is enabled. If that option is disabled, you must configure the dependency yourself. To view and add dependencies, select a target and open its build phase settings.

How does Xcode choose target?

Go to project's settings in the Project Navigator panel. Under the Targets sections, right click the existing target and select Duplicate to copy your existing target. 2. Xcode will ask you if your new target is for iPad development.


2 Answers

I found all my build and test problems were related to having the same binary name. Renaming the binaries produced by each target to be unique fixed the problem.

like image 135
pr1001 Avatar answered Nov 14 '22 23:11

pr1001


I just had the same issue. In my case the additional target appeared in the build settings of the scheme's target. You can search for the undesired target name there, I found mine under BUNLDE_LOADER and TEST_HOST. It got fixed after I deleted the settings.

like image 23
silyevsk Avatar answered Nov 14 '22 23:11

silyevsk