rustylepord rustylepord - 1 year ago 103
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 ?

Answer Source

The solution is to escape the whitespace character:

\@\"Test\ String\"

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download