Adding a build configuration in Xcode
Asked Answered
S

3

179

I'd like to add a new build configuration in Xcode 5, "QA", to the other three we currently have (Debug, Distribution, Release). However, when I click "Editor > Add Configuration", everything is grayed out. I'm not very familiar with Xcode in the first place, so I'm not sure how to go about doing this.

Is there a reason it's grayed out? Is this this process to add a build configuration? Thanks.

Shani answered 7/11, 2013 at 17:34 Comment(2)
Here it is an article may be it will help you guys. Here you will see the sample code + in details how you can set your staging and release web urls, keys and much more using build configurations. I saw various resources but there was not a sample of full code. Thats why i have added the full sample code with detail description of how you can generate set build configurations using plist and automated process of build configurations, while creating archive for release and testing mode. github.com/ourangzeb/Build-Configuration-for-IOSAeronautics
The excellent selected answer seems to be relevant only for now quite old versions of Xcode. For recent Xcode versions there is another excellent answer. Would it make sense to amend the accepted answer to be appropriate for the current Xcode?Bowel
T
36

For Xcode 11 + , you can add your custom configuration here:

enter image description here

Tyrontyrone answered 2/12, 2019 at 7:51 Comment(1)
That's also true for earlier Xcode versions. You don't need to use the menu bar (I didn't even realize you could before finding this question)Filberte
D
299

I ran into this same problem and figured it out. Here is a screenshot of the problem. I want to duplicate my "Release" configuration, but the option to do so is disabled. Why?

enter image description here

The answer is hiding behind this little button here (circled in red)...

enter image description here

This menu will open to reveal that you currently have a build target selected. Build targets don't have their own configurations.

Configurations are project-wide. If you select the project file, the menu will work, as shown here.

You also have to make sure that the 'Info' tab is selected, the options are still greyed out if you are on the 'Build Settings' page

enter image description here

Dikmen answered 9/11, 2013 at 19:24 Comment(6)
You also have to make sure that the 'Info' tab is selected, the options are stil greyed out if you are on the 'Build Settings' pageObsequent
"Editor (!) menu", then select Info, then select Project... Apple, why this simple thing require people to ask questions on SO?Ine
I followed this answer exactly (YES, I've selected by project as in the screenshot, YES, I selected Info tab THEN my project) but all those options are still greyed out?Stebbins
For me it was working only when I pressed "Build Settings" tab. However, you can scroll "Build Settings" down to "User-Defined" section and add setting manually.Cooperman
what a bad UX that is. You really have to make sure all those tiny things align properly to enabled those menu items.Yeti
Yes, it's 99% of learning xcode - all those tiny little icons under which so much is hidden.Blockhouse
T
36

For Xcode 11 + , you can add your custom configuration here:

enter image description here

Tyrontyrone answered 2/12, 2019 at 7:51 Comment(1)
That's also true for earlier Xcode versions. You don't need to use the menu bar (I didn't even realize you could before finding this question)Filberte
E
4

Build Configuration and Build Configuration File(.xcconfig)

It allows you to manage Build Settings. It is actually what you see when reviewing Build Settings and it's mirrors(like Signing in Signing & Capabilities)

enter image description here

Build Configuration(e.g. Release/Debug) -> Build Configuration File(.xcconfig) or some default config file

[Xcode structure]

Build Configuration

Actually Debug/Release Build Configurations are created by default

Create Build Configuration

You are able to create a new Build Configuration via duplicating an existing(Debug/Release) in Configurations

Editor -> Add Configuration -> Duplicate <configuration_name> Configuration -> Click plus button under configuration list
//Set a name - Experiments for example

enter image description here

Select Build Configuration

Scheme -> Info -> Build Configuration

Build Configuration File(.xcconfig)

Much more powerful feature is build configuration file which you can assign for your configuration

File -> New -> File... -> Configuration Settings File
//Do not include it to any target

Project -> Info -> Configurations -> Build Configuration -> Target -> Build Configuration File

enter image description here

Please note that you are able to set Build Configuration File for Project and for Target. Depends on it Resolved variable will be set, also $(inherited)[About] will be different

For example add name into Build Configuration File

PRODUCT_NAME = THE BEST NAME

The result you can find on Build Settings

enter image description here CocoaPods and Build Configuration File

project '<project_name>', '<scheme_name_1>' => :<build_congiguration_file_name_1>
//For example
project 'MyProject', 'debug' => :conf1, 'release' => :conf2

Build Configuration File(.xcconfig). You can use next syntax to add or override the parent parameters

#include "<path_to_xcconfig>"
Erectile answered 8/10, 2020 at 16:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.