15
votes

From the docs it says about schemes:

"An Xcode scheme defines a collection of targets to build, a configuration to use when building, and a collection of tests to execute."

So I thought I create one debug scheme and one release scheme and set the build settings for Project and targets accordingly, ie using the distribution profiles for release scheme and the develop profile for debug.

But these settings DO NOT change when I select different schemes. In fact when I set the code signing to distribution it remains - switching to different schemes does not change anything.

Many thanks for clarifying!

2

2 Answers

27
votes

You're confusing build configurations and schemes. Xcode projects have two build configurations: Debug and Release. In the build settings editor, you can give build settings different values for the Debug and Release build configurations. Click the disclosure triangle next to a build setting to show the values for the Debug and Release configurations. In your example you would find the Code Signing Identity build setting in the build settings editor. Set the value of the Code Signing Identity build setting to your develop profile for the Debug build configuration, and set it to the distribution profile for the Release build configuration.

After setting the build settings for the Debug and Release build configurations, use the scheme editor to choose the build configuration to use. The scheme editor has the following actions where you can choose the build configuration: Run, Test, Profile, Analyze, and Archive. Xcode initially uses the Debug configuration for running, testing, and analyzing and uses the Release configuration for profiling and archiving. The Run action is the one you're most likely to change over the course of developing your app.

In most cases you can get away with one scheme. You don't normally need one Debug scheme and one Release scheme. The main reason you would need one Debug and one Release scheme is if you needed to run, test, profile, and analyze your app for both the Debug and Release build configurations.

4
votes

Contrary to the accepted answer above in Xcode 7 (at least) schemes definitely do maintain their own debug and release settings. You can maintain separate debug and release "schemes" and use them to switch quickly between the two builds using the shortcut control-command-left/right bracket (previous / next scheme).

The advantage of this is being able to quickly jump back and forth between a release and a debug build when doing finicky performance testing. Release builds with optimizations turned on take forever and mess with the stack traces, etc.