I want to add two Macros.
I want to separate my BASE URL from other URLs, so in future I need to only change in one place instead of every place.
Below is the code I am trying and getting error.
I am getting "Use of undeclared identifier BASE_URLPOST_URL1" error
Ultimately I want to concatenate two Macros or can say want to concatenate two strings using Macros, dont know whether this is right way or not, IF NOT, please let me know any other solution.
I want to separate my BASE URL from other URLs, so in future I need to only change in one place instead of every place.
Below is the code I am trying and getting error.
Code:
// this is written in some header file
#define BASE_URL "http://www.baseurl.com/"
#define POST_URL1 @"getVideos/movies/1"
#define POST_URL2 @"getSongs/movies/1"
#define POST_URL3 @"getPictures/movies/1"
#define COMBINED(base,post) base##post
// calling this line from some function
- (void)someFunction
{
NSString *myMainUrl = [NString stringWithString:COMBINED(BASE_URL,POST_URL1)];
}
Ultimately I want to concatenate two Macros or can say want to concatenate two strings using Macros, dont know whether this is right way or not, IF NOT, please let me know any other solution.