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

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


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


Your question is not very clear... If you want multiple conditions in a #ifdef, here is a solution:

#if defined(MYAPP_RELEASE) && defined(MyApp_Staging)    // ...#else    // ...#endif


In Swift and Xcode 7, the syntax has changed:

#if DEBUG || RELEASE    let URL = "https://www.example.com/beta"#elseif APPSTORE    let URL = "https://www.example.com/prod"#endif