HeisenBerg HeisenBerg - 1 year ago 122
iOS Question

Objective C Macro append to string

I think this is a very simple thing to do, but since I'm new to iOS development and objective C, I can't figure it out.

#define RESTFUL_PATH_PREFIX @"https://gogch.com/gch-restful";

I want the result

but I'm getting the result as

other topics in stackoverflow mention only about adding a new string to the beginning of a string like,

#define DOMAIN "example.com"
#define SUBDOMAIN "test." DOMAIN

Answer Source

Remove the trailing semi-colon:

#define RESTFUL_PATH_PREFIX @"https://gogch.com/gch-restful";

and then string constants can be concatenated by the compiler:

@"first" @"second"

instead of:

@"first"; @"second"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download