Most of the models in my iOS app query a web server. I would like to have a configuration file storing the base URL of the server. It will look something like this:
The way I define global constants:
AppConstants.h
extern NSString* const kAppBaseURL;
AppConstants.m
#import "AppConstants.h"
#ifdef DEBUG
NSString* const kAppBaseURL = @"http://192.168.0.123/";
#else
NSString* const kAppBaseURL = @"http://website.com/";
#endif
Then in your {$APP}-Prefix.pch file:
#ifdef __OBJC__
#import
#import
#import "AppConstants.h"
#endif
If you experience any problems, first make sure that you have the Precompile Prefix Header option set to NO.