Consider the following call:
NSString* localized = NSLocalizedString([NSString stringWithFormat:@"Hello %@", @"World"], @"");
What is wrong with it? I see nothing inherently wrong, yet the compiler/preprocessor complains that too many parameters were passed to it. On the other hand, the following two compile:
Explicit variable:
NSString* string = [NSString stringWithFormat:@"Hello %@", @"World"];
NSString* localized = NSLocalizedString(string, @"");
Wrap in brackets:
NSString* localized = NSLocalizedString(([NSString stringWithFormat:@"Hello %@", @"World"]), @"");
Looks like the preprocessor/compiler incorrectly parses the ,
character.
I am getting this in Xcode 7 beta 6, so it might be a new bug in the Clang toolchain.