user891268 user891268 - 5 months ago 15
Objective-C Question

How to write if condition in #ifdef. for Staging. in objective-c

I need to add one more condition inside this call Staging..

how to do it in this condition.

#ifdef MYAPP_PRODUCTION
buildMode = @"Production";
#else

#ifdef MYAPP_RELEASE
buildMode = @"Release";
#else MYAPP_DEBUG
buildMode = @"Debug";
#endif
#endif


another is
MyApp_Staging
need to include in this if condition how to do this?

Answer

You could do something like this to contain all the different options including the new Staging Mode and make the whole statement cleaner:

#ifdef MYAPP_PRODUCTION
    buildMode = @"Production";
#elif MYAPP_RELEASE
    buildMode = @"Release";
#elif MYAPP_DEBUG
    buildMode = @"Debug";
#elif MYAPP_STAGING
    buildMode = @"Staging";
#endif