SnowLeopard Xcode warning: "format not a string literal and no format arguments"

Posted by Justin Galzic on Stack Overflow See other posts from Stack Overflow or by Justin Galzic
Published on 2009-11-05T01:38:28Z Indexed on 2010/04/08 1:43 UTC
Read the original article Hit count: 502

Since upgrading to the latest XCode 3.2.1 and SnowLeopard, I've been getting the warning,

"format not a string literal and no format arguments"

on the following:

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 statement? And what is the recommended way to fix it so that the warning isn't generated?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about warnings