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

user891268 picture user891268 · Aug 26, 2011 · Viewed 30.9k times · Source

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

Suhail Patel picture Suhail Patel · Aug 26, 2011

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