I have a define:
hashdefine kPingServerToSeeIfInternetIsOn "http://10.0.0.8"
then in code I with to use it:
NSString *theURL = [NSString stringWithFormat:@"%@", kPingServerToSeeIfInternetIsOn];
I get an exception.
What’s the best way to define the const for the application and use it in a NSString init?
Create a header file, e.g.
MyAppConstants.h. Add the following:In the definition, e.g.
MyAppConstants.m, add:In your class implementation, add:
You can use the constant as you have done already.