user3470095
user3470095

Reputation: 81

Xcode debugger values nil when using different build configuration

I've decided to manage different PREPROCESSOR definitions for the same application target using different schemes that are hooked up to different build configurations. Meaning I have duplicated the Debug build configuration and gave it a new name (e.g. Staging). Afterwords defined Preprocessor macros that are defined to each new build configuration. Setup a new shared scheme that the "Run" step uses the new "Staging" (Debug duplicate) build configuration I have just created. The app runs fines, but I've noticed the debugger values are all nil. When setting the scheme to run from the "Debug" build configuration everything is fine. The new build configuration is a complete duplicate of the Debug one with an addition Preprocessor macro defined. This also occurs when renaming the Debug build configuration to anything else.

Is there any way to get the debugger to work with different (debug enabled) build configurations?

Upvotes: 8

Views: 537

Answers (3)

Konstantin Pavlikhin
Konstantin Pavlikhin

Reputation: 696

I experience the same issue with Xcode 6.3.1 (6D1002). I have a configuration that precisely copies the default 'debug' configuration, but from time to time debugger window shows nil values (while it is clearly visible from the program flow that values are actually present). I have no idea how to fix this since every one who is being asked about this issue hits you to turn off compiler optimizations like a Captain Obvious.

Upvotes: 0

Christian Kaas
Christian Kaas

Reputation: 29

You probably have optimizations for that build scheme enabled. Happens to me when i run my apps in my archive scheme which always has optimizations turned on.

Check the scheme's run configuration and turn debug in there. (Run -> Info -> Build Configuration)

Upvotes: 1

user1041311
user1041311

Reputation:

How are you setting preprocessor macros?

You should do it like this:

Project > Select wanted target > build settings > search for 'Preprocessor Macros' > add macro - I'm using PRD_BUILD || BETA_BUILD || DEMO_BUILD || DEV_BUILD

Then you must check what are you actually running:

#if PRD_BUILD || BETA_BUILD || DEMO_BUILD
 code
#elif STG_BUILD
code
#else
code
#endif

Upvotes: 0

Related Questions