rustylepord rustylepord - 5 months ago 31
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 ,

TEST_STRING = $(TEST_STRING)


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 ?

Answer

The solution is to escape the whitespace character:

\@\"Test\ String\"

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