RickiG
RickiG

Reputation: 11390

How to setup Xcodes "debug/release target settings"?

I have found a set of great macros here Objective C Macros

I put the:

#if DEBUG==1
#define .... macros

in my header file.

Now I simply can't figure out where to set DEBUG=1 or DEBUG=0 in Xcode so that it will define the macro when debugging and not when releasing.

Hope someone can help me find the missing drop down menu:)

Upvotes: 4

Views: 3149

Answers (1)

Gregory Pakosz
Gregory Pakosz

Reputation: 70254

EDIT:

Ok apparently, when working on an iPhone application, you have to:

  • select iPhone device as the active sdk
  • then edit project or target settings and in "Other C Flags" you type "-DDEBUG=1"

Edit your project or target settings, select your Debug configuration then look for the "Preprocessor Macros" settings and type DEBUG=1

However, I would rather define NDEBUG in the Release configuration then write

#ifndef NDEBUG // if we are in debug mode
#define bla bla bla
#endif

Note: you need to have a target that compiles Objective-C source files to a library or application properly set up; otherwise the settings don't appear in the UI.

Upvotes: 2

Related Questions