In my development I wish to hit a development URL when im testing but when the app is run on my iPhone, I want it to run on production URL. How do I get about setting this i
There are lots of ways to do this. My preferred method is to create a file called Constants.h that looks like this:
//
// Constants.h
//
#ifndef Constants_h
#define Constants_h
#pragma mark - Instances
#ifdef DEVELOPMENT
#define ROOT_URL @"http://127.0.0.1:8000"
#endif
#ifdef STAGING
#define ROOT_URL @"http://staging.example.com"
#endif
#ifdef PRODUCTION
#define ROOT_URL @"http://production.example.com"
#endif
Then, I just include it in my *-Prefix.pch file like this:
#ifdef __OBJC__
#import
#import
#import "Constants.h"
#endif
In your build settings, set DEVELOPMENT, or STAGING, or PRODUCTION = 1.
Now you can access things like ROOT_URL anywhere in your project.
Good luck!