Running a release build with Xcode 4

XcodeBuildRelease

Xcode Problem Overview


I see how Xcode 4 splits the info on your targets nicely in one view, but how does one build and run these different builds? All I see are the options to build and to run, and these options to build for running, testing, and profiling. It's not clear to me how these map to the build configurations, though.

Xcode Solutions


Solution 1 - Xcode

Xcode 4 introduces schemes which provide all the options on how to build/run/profile/etc. your application. You can change the active scheme using the Scheme drop-down button at the top of the project window and/or edit the scheme via Product > Edit Scheme… ⌘< menu item. Then on the left source list, you can select the Run item, and in the Info tab in the right pane you can choose to use the Release configuration in the Build Configuration drop-down.

Solution 2 - Xcode

In Xcode 4.3 -- go to Product/Build For and select Archiving. This compiles a release build and places it in an obscure folder which you'll never find on your own. The quickest way to get there is to select your app in Xcode's project navigator (in the Products folder), right-click, select Show in Finder. It will take you to the debug build but the release build is in a folder right next to it.

Solution 3 - Xcode

To add to Adam Bryzak answer, you need to activate the DEBUG and release (and adhoc if needed) in the build settings settings.

Under project/Build settings, search for Preprocessor Macros and set the Debug and release values to 1 in order to activate them:

enter image description here

This way, in the edit schemes, when you switch between DEBUG and release, Xcode will know that he should to change the build mode.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJoeyView Question on Stackoverflow
Solution 1 - XcodeAdam BryzakView Answer on Stackoverflow
Solution 2 - XcodeRick BidlackView Answer on Stackoverflow
Solution 3 - XcodeMallocView Answer on Stackoverflow