Thursday, September 19, 2013

using multiple #define statements to create urls

using multiple #define statements to create urls

I want to define a base URL in my app:
#define kBaseURL @"http://mydomain.com/"
And the also be able to create other URL's using this as a base
#define kProductsURL @"/products"
I know I could do something like this:
NSString *urlString = [NSString stringWithFormat:@"%@%@",
kBaseURL,kProductsURL];
How do I alter the kProductsURL I can just use kProductsURL with having to
do the string formatting?
I know there is a ton you can do with the #define statements but I have
not been able to find a good tutorial or documentation.
Can someone point me in the right direction?

No comments:

Post a Comment