Sometimes you need different settings for different purposes (for example, when you’re testing your app). You could use a server for development and another for production, try to do something hard code when you are testing In App Purchases or something else…
Conditional compilation is very useful in these scenarios. While blocks of “if” from programming languages are part from the binary file but only one block is executed at time (but both could be, in different moments), the conditional “if” is executed during compilation and so the negated block won’t be part of te binary file.
You need to add a compilation flag in your project settings. In the example below, the flag -DDEBUG_BUILD was added to the target settings.
#ifdef DEBUG_BUILD #define SERVER_URL_STRING @"http://development.server.com" #else #define SERVER_URL_STRING @"http://production.server.com" #endif