I have a string constant defined like this:
#define kMyString @"This is my string text!";
Somewhere in the code I would like to print-out this piece of code with NSLog like that:
NSLog(@"This is it: %@",kMyString);
But get a build error: Expected expression
.
I have already looked at the Apple's Format Specifiers but could not figured it out.
Can someone please explain it to me how to do this?
Thanks!
You should remove ;
from the definition of kMyString
:
#define kMyString @"This is my string text!"
The way you did it is equivalent to:
NSLog(@"This is it: %@", @"This is my string text!";);