简体   繁体   中英

Preprocessor Directives to separate targets in xcode

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM