Since upgrading to the latest Xcode 3.2.1 and Snow Leopard, I've been getting the warning
"format not a string literal and no format arguments"
from the following code:
NSError *error = nil;
if (![self.managedObjectContext save:&error])
{
NSLog([NSString stringWithFormat:@"%@ %@, %@",
errorMsgFormat,
error,
[error userInfo]]);
}
If errorMsgFormat
is an NSString
with format specifiers (eg: "print me like this: %@"
), what is wrong with the above NSLog
call? And what is the recommended way to fix it so that the warning isn't generated?
NSLog()
can take one argument, when the format string contains no format specifiers. – Radbun