Is there a way to create an
if statement based on compile settings? I have an App that accesses a web-based API and when compiling in debug mode I want it to use the private beta version but when I compile for release I want it to use the public live version of the API.
At the moment I just have a
NSString holding the url address.
Typically for this sort of thing you would use a preprocessor directive:
#ifdef DEBUG_MODE // connect to beta version #else // connect to live version #endif
You can either define your own
DEBUG_MODE symbol, or you can use an existing one (I'm not sure what it might be called for the iPhone SDK).
To extend on Greg's answer, you can pass the compiler flag -DDEBUG_MODE (or -D[any name here]) to define DEBUG_MODE and cause the first branch of the #ifdef to be compiled.