Xcode - is adhoc build debug or release? - xcode

I have flag in other swift flags for debug so I can have macro in code for DEBUG. Will it trigger in ad-hoc ? How will work ad-hoc build ? As debug or release ?

The default is release but you can change this in the scheme editor

Watch your scheme details to see which configuration is used for the Archive stage (as I assume you're making the Ad-Hoc build from the archived product).
In the menu bar, navigate to Product > Scheme > Edit Schemeā€¦ and switch to the one you're currently building if needed.

Related

How do I set the compiler options?

I am Code::Blocks 13.2 user in Ubuntu 14.04 LTS. How do I set the compiler options, such as compile under Debug or Release mode? I don't see the options readily on the GUI.
'Debug' mode and 'Release' mode are not compiler options. They are options in the
IDE for configuring the whole project (including the compiler options and
all other tool options) between debug mode and release mode.
In the tool bar beneath the top menu bar of the IDE you should see a drop-down menu
that has items Debug and Release for selecting the desired configuration.
See screenshot:-
What the various tool options will be in debug mode and release mode is up to you. The IDE has
sensible defaults. You can set them by navigating YourProject -> Build options
and selecting Debug or Release from the project tree-control of the left
before continuing. See Screenshot:-
To set up the compiler go to Settings->Compiler.
To set up your projects target settings (debug, release, etc...) right click on your project and go to build options.
You may also want to take a look at the over all project settings by also right clicking on the project and going to properties.
If your just editing files on their own you have to add them to a project first (otherwise why are you using an IDE in the first place?) by going to file->new->project
Settings ->Compiler->Global Compiler Settings->and there you can change your settings with flags or defines, and other options.

Cannot see build phases, general settings in Xcode 6.1

I just downloaded the XCode 6.1 seed.
I am have this issue with one specific project.
The project information view is absolutely different.
The General, Build phases sections are all missing.
All I can see is info and build setting.
Anyone else faced this issue?
None of my other old projects has this issue.
It's a sneaky one - you click the show/hide Project Targets List icon and it pops out the Project name and its targets underneath.
Click one of those and you'll get the Build Phases option showing up.
OP's problem was that the Build Phases did not show up when opening the project settings.
Simple Fix:
Expand the left side bar.
Your project file is selected. (in my case it's called "opengl-series")
This is the problem.
You want to select the App. (in my case "CGTutorial")
Build phases now shows, along with the other settings.

How to toggle running Xcode project in debug or release mode by using only shortcut keys?

By default, to "run" my project in release mode, I need to edit the scheme's run settings to use "release" instead of debug.
To not have to edit the scheme each time I want to switch between debug and release mode, I created a new scheme which runs in release. But this is still tedious since I need to click on the relevant scheme if I want to switch.
Is there a way that I can automatically (build + run) in debug / release mode using only short cut keys ?
I don't wan't to profile! Because that launches instruments etc.
EDIT: To be clear - I'm always running on the device.
Debugging build: "Product" Menu => "Build For" => "Running" (shift-command-R)
Release build: "Product" Menu => "Build For" => "Profiling" (shift-command-I)
Run without building (whichever you just built): "Product" menu => "Perform Action" => "Run without building" (control-command-R)
The equivalent in XCode that you seek is the "schemes".
Right of the play/stop buttons, there a pretty handy scheme selector. You just need to create a scheme for debug and another for distribution.
In order to make a scheme for debug or distribution, simply go to the scheme configuration (either selecting "edit scheme..." or "new scheme...") and choose the correct build configuration under "Run -> Build Configuration":
Note: I have XCode 9.1, I don't know if this is valid for older versions.
There is one way that I use it for my projects.
In Xcode, go to the the project settings (project, not target) and add "beta" configuration to the list:
Then you need to create new scheme that will run project in "beta" configuration. To create scheme go here:
Name this scheme whatever you want. The you should edit settings for this scheme. To do this, tap here:
Select Archive tab where you can select Build configuration
Then you need to add a key Config with value $(CONFIGURATION) the projects info property list like this:
Then its just the matter what you need in code to do something specific to beta build:
let config = Bundle.main.object(forInfoDictionaryKey: "Config") as! String
if config == "Release" {
// app running in release configuration
}
else if config == "Beta" {
// app running in beta configuration
}
In XCode 7 you can switch between schemes using the shortcut: control-command-right/left bracket (select next scheme, select previous scheme). So I think creating two schemes is your best bet.
BTW, for everyone asking why one would do this - If you are writing a high performance piece of code you will find yourself constantly switching between release and debug mode for a lot of reasons. Release mode (especially in swift with whole module optimization on) takes forever to build and optimization changes stack traces, etc.

XCode 4.3.3 Appears to always run debug build version

I'm using Xcode 4.3.3 and have tried to configure my (one and only) scheme so that "Run" will build a release version (i.e. non-debug version) of my app for testing on the simulator and my device.
I attempt to do this as follows:
In the scheme editor window I highlight "Run" in the left column, and then for "Build Configuration" I select "Release". (I also set the debugger to "None").
However, when I build & run the application, the log navigator displays "Build MyApp1" followed by "Debug MyApp1".
My questions are: should this message displayed by the log navigator say "Release MyApp1" to reflect the build type I selected in the scheme editor? Or does "Debug" in this message just always get displayed when you choose "Run"? Is it in fact running the debug or release version?
Thanks,
BH
Go TO Edit Scheme, choose the type that you want.
In order to test whether your compiled file is running a debug version, you can try something like this in your home controller's viewWillAppear:
#ifdef DEBUG
NSLog(#"running debug version");
#else
NSLog(#"running another version");
#endif
If you're not getting the result you're expecting, you can try setting the release flag to YES and debug flag to NO in build settings.
I hope this helps :-)

precompiled header name gets stuck

I'm new to xcode and I must be missing something.
Create a new command-line project. Call it tempprog (for instance).
Select Project/Edit Project Settings.
Edit the name of the prefix header (tempprog_Prefixz.pch).
Build - it will fail, of course, looking for tempprog_Prefixz.pch
Now change the name of the prefix header back to tempprog_Prefix.pch.
Build again - it should work, but doesn't. It's still looking for tempprog_Prefixz.pch
Cleaning does not rectify the situation. What am I missing here? Where is the Prefixz.pch name being retained? If you look in the build output at the ProcessPCH command you can see that it still wants to use Prefixz.
It turns out there's a system of setting priorities.
From Working With Xcode Build Settings:
The levels at which build settings can be set, and their precedences are:
xcodebuild command-line flags (only applicable for command-line builds)
The target, editable via a target's Info inspector
The project, editable via a project's Info inspector
Xcode application settings, as set in Xcode > Preferences...
Xcode's built in defaults
The user environment, perhaps as set in a user's ~/.MacOSX/environment.plist file
Restarting your mac fixes the problem.

Resources