rustylepord rustylepord - 8 months ago 40
iOS Question

Unexpected '@' in program with User Defined Settings in Xcode

Following user defined setting is declared on Xcode ,

TEST_STRING = \@\"Test String\"

Declared following on preprocessor macro section ,


However when I try to use this , getting a build failure with

"Unexpected '@' in program"

Program compiles without the whitespace in the string,

TEST_STRING = \@\"TestString\"

Is there any other way I can have a string on user defined settings which supports white spaces ?


The solution is to escape the whitespace character:

\@\"Test\ String\"

For example, NSLog(TEST_STRING); will give you Test String in the console