Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to select debug/release mode in Xcode4? [duplicate]

Tags:

xcode4

Build for debug is just press on the PLAY symbol, but I don't know how to Build for distribution/release?

like image 490
Anonymous Avatar asked Mar 13 '11 03:03

Anonymous


People also ask

What is the difference between debug mode and Release mode in Visual Studio?

Visual Studio projects have separate release and debug configurations for your program. You build the debug version for debugging and the release version for the final release distribution. In debug configuration, your program compiles with full symbolic debug information and no optimization.

What is difference between debug and Release build?

Debug Mode: When we are developing the application. Release Mode: When we are going to production mode or deploying the application to the server. Debug Mode: The debug mode code is not optimized. Release Mode: The release mode code is optimized.


Video Answer


9 Answers

The short answer is:

  1. choose the iOS scheme from the drop-down near the run button from the menu bar
  2. choose product > archive in the window that pops-up
  3. click 'validate'
  4. upon successful validation, click 'submit'
like image 82
benvolioT Avatar answered Oct 01 '22 02:10

benvolioT


You can use command line tool to build the release version. Next to your project folder, i.e.

$ ls
...
Foo.xcodeproj
...

Type the following build command:

$ xcodebuild -configuration Release
like image 23
Shao-Chuan Wang Avatar answered Sep 30 '22 02:09

Shao-Chuan Wang


The "play" button is specifically for build and run (or test or profile, etc). The Archive action is intended to build for release and to generate an archive that is suitable for submission to the app store. If you want to skip that, you can choose Product > Build For > Archive to force the release build without actually archiving. To find the built product, expand the Products group in the Project navigator, right-click the product and choose to show in Finder.

That said, you can click and hold the play button for a menu of other build actions (including Build and Archive).

like image 36
Joshua Nozzi Avatar answered Sep 29 '22 02:09

Joshua Nozzi


XCode>Product>Schemes>Edit Schemes>Run>Build Configuration

like image 40
TechnoTim Avatar answered Oct 01 '22 02:10

TechnoTim


They've bundled all the target/build configuration/debugging options stuff into "schemes". The transition guide has a good explanation.

like image 31
Rob Agar Avatar answered Oct 01 '22 02:10

Rob Agar


To set the build configuration to Debug or Release, choose 'Edit Scheme' from the 'Product' menu.

Then you see a clear choice.

The Apple Transition Guide mentions a button at the top left of the Xcode screen, but I cannot see it in Xcode 4.3.

like image 20
John White Avatar answered Sep 27 '22 02:09

John White


I have a large app that was having problems uploading to the AppStore using the archive method you will find in XCode 4. The activity indicator kept spinning for hours whether I was trying to validate or distribute, so I created a support ticket to Apple. During that process, I found out you could right click on the .app in your Products folder inside the Project Navigator of XCode, and compress the app to submit using the Application Loader 2.5.1. (aka the old method). Only the Debug - iphoneos folder is accessible this way (for now) and once Apple responded, this is what they had to say:

I'm glad to hear that Application Loader has provided you a viable workaround. Discussing this situation internally, we're not sure that submitting the Debug build will pose too much of a problem (so long as it was signed with the App Store distribution profile, as you mentioned it was). The app will likely be slower as the debug switches are turned on and optimizations are turned off for the Debug configuration, though it will still run. App Review will ultimately determine whether or not that's ok, as I'm not sure that's something they check for. You could try reaching out directly to App Review to confirm this, if you wish. However, since App Loader is working for you, I do recommend rebuilding the app with your Release configuration and resubmitting to play it safe. To find your Release build in Xcode 4.x, control-click on the Application Archive on the Archives tab in the organizer, and choose "Show in Finder." Then, control-click on the .xcarchive file in Finder and choose "Show Package Contents." The release built .app file should be located within the /Products/Applications folder.

This was very helpful information for developers who are having problems with the archive method, and my app is now uploading successfully without any concern that it won't run to the best of it's ability.

like image 44
whyoz Avatar answered Sep 30 '22 02:09

whyoz


That part is now located under Schemes. If you edit your schemes you will see that you can set the debug/release/adhoc/distribution build config for each scheme.

like image 41
Pacu Avatar answered Sep 27 '22 02:09

Pacu


Product -> Archive, later, press the distribute button and check the option Export as Application or what you want

like image 44
fenixkim Avatar answered Sep 30 '22 02:09

fenixkim