I get the “format not a string…” message when doing the following:
NSString* string1 = [[NSString alloc] initWithFormat:NSLocalizedString(@"Update Now", @"Update Now Item")];
NSString* string2 = [[NSString alloc] initWithFormat:NSLocalizedString(@"Register", @"Register Now")];
It works fine i.e. the app doesn’t crash on the device or simulator, and the localized text displays just fine also.
I’m trying to understand why is it then that I’m getting this particular error message. As far as I’m aware this is how you’re meant to use localized strings in Objective C.
The warning reported by the compiler is correct. The string returned from
NSLocalizedString(@"Update Now", @"Update Now Item")is not a format string, because it does not have format specifier inside.As Ican Zilb said in another answer, the best solution is to directly use: