I have a large app with multiple schemes and configurations. Ever since I use the new build system, Xcode shows info off the wrong build configuration.
I have 10 configurations and 10 schemes.
If I select scheme4 it should use configuration4 but it doesn't. It always uses the first configuration that is listed in Project -> Info.
Every time I go to my Target -> Info, it should show info of the current build configuration settings of that scheme but it doesn't. If I switch back to the old build system it works like intented ...
Related
As you know when you create a new Xcode project you have two configuration already created for you: Debug and Release.
I created two more because I have different headers for device and simulator build.
I set the paths for every configuration.
Now I want to know how to set the project to run the specific configuration automatically?
At first I thought a scheme was a list of values for each build type. By default, there are two schemes, Debug and Release. In the app target, you customize each scheme on the fly by choosing the values (in the default case for either Debug or Release).
However, now I think the schemes are bigger than that. Your project comes with one scheme by default, and included in that scheme is the ability to customize settings for different build types, including run, test profile, etc... So in ONE scheme you can have settings xyz for the run phase, and in ANOTHER shceme you can have settings abc for the run phase.
I'm a little confused here. Can anyone simplify this?
Thanks
From Xcode's Help:
scheme
A scheme is a collection of settings that specify the targets to build for a project, the build configuration to use, and the executable environment to use when the product is launched. When you open an existing project (or create a new one), Xcode automatically creates a scheme for each target. The default scheme is named after your project.
Here, "build configuration" is what you're calling "Debug" and "Release" above.
I understand that when I run Project -> Build, it does what I set in "Build" part of current scheme. I see my targets there, so I want to choose which target to build. But there are checkboxes near each target. I can't get what do they do..
Here is screenshot:
Analyze performs static code analysis.
Test runs your unit tests.
Run runs your application.
Profile runs a profiling application for measuring speed.
Archive creates an archive of your built app, for installing on devices or for uploading to the App Store.
From what I can tell these allow you to build your project for various purposes, Running, Profiling, Archiving, etc.
Try unchecking the Profiling checkbox then building your project for Profiling Product -> Build For -> Profiling (Shift+Cmd+I). You will get an error stating Your scheme XXX is not configured for Profiling.
So I guess it's just simply a way to enable or disable different types of builds.
Is there a compile time variable that lets me detect whether the current build is for debug or release? If not, how can I define my own?
As of Xcode 4, the Build, Run, Test, and Analyze actions produce Debug builds by default; the Profile and Archive actions produce Release builds. This is controlled by editing the scheme, selecting the action, then changing the build configuration under the Info tab. To Apple in Xcode 4, the Archive action is the final "build this for release so I can distribute it" action. This is the highest level at which you manage these settings.
At the lower level, your target contains its build settings, which define configurations. By default, there are two configurations: Debug and Release. You can find (and manage) them by selecting the project (the root node) in the Project navigator, then choosing the Info tab. They're found under the Configurations group.
To edit the settings for the various configurations for a given target, choose the target in the Targets list, then choose the Build Settings tab. The grid looks (and sort of is) complicated and you should read the docs for details (esp. the what the different columns represent). To answer your question, each setting can be edited to change the setting for all configurations or expanded with the disclosure triangle so you can specify configuration-dependent settings. For example: under Release configuration, you might want to strip debugging symbols; under Debug, you do not.
I have 3 configurations in my project (Debug, Distribution_AdHoc and Distribution_AppStore). In Xcode 3 we had a list to choose device, version, configuration and target before build and run. Now with Xcode 4 we only have the device kind and version in this list. This bring my two questions:
So where is defined the configuration used ? Is that the configuration defined in "Project > Info > Command-line builds use: Debug" ?
And now the "Project" menu is replaced by "Product" So where can we create (or duplicate and edit) a Configuration ?
Thank you.
Just in case you still want to make a Distribution config (or other config--I still find them useful), after great length (read: searched in the help for 'duplicate'), I found this:
At first, they were all grayed out; this was because I had one of the targets highlighted in the editor (MFE, MFETests, etc.). If you highlight your project (as in the screenshot), they become enabled.
You can use alt(option) and click on either, run, test or profile to see the option.
Here you can set the target for each option.
For Archive the release is normally used, since can you resign your app via the organizer there is no need ad-hoc and appstore target any more.
For part 1 of your question,
The configuration is set in the schema window. apple+shift+comma to get to the window. Or Product > Scheme > Manage Schemes from the menu bar.
In the window, click the type of build you want on the left panel: Build, Run, Profile, Analyze, or Archive. In the window tab usually, along the type, there is an option Build Configuration that can be set. Select Debug, Release, or whichever configuration you want there.
The exception if the build task. The build task uses whatever configuration is set for the Run task. Also, the analyze and archive tasks only have one tab, so using the info tab is not necessity.
Apparently, "build" is shorthand for "build for run"...