0

I have 2 targets on my project one production and one stage with different configurations. I want in the code to be able to say

#if target == production
NSLog(@"production");
#elif target == stage 
NSLog(@"stage");
#endif

Can someone please tell me how can I do that?

Thank you,

~Sonic555gr

rmaddy
  • 314,917
  • 42
  • 532
  • 579
L_Sonic
  • 594
  • 6
  • 22
  • You could also make this target determination at runtime. See http://stackoverflow.com/questions/6964630/xcode-project-how-to-detect-target-programatically-or-how-to-use-env-vars – jarmod May 02 '13 at 15:25

1 Answers1

10

You can define some Preprocessor Macros for each Target, like this... ...

And then you can do something like this:

#ifdef PRODUCTION
   //some Code
#elif STAGE
   //some other Code
#else
   //more Code^^
#endif

But be carefull if you need it in Debug- and/or in Release-Build, you have to declare it there.

xapslock
  • 1,119
  • 8
  • 21