Assuming qFileTxtName and aString defined as NSString* , then the code you provided does not raise any warnings.
NSString *qFileTxtName = @"110327"; NSString *aString = [@"xxxx_" stringByAppendingString:qFileTxtName];
I think you wanted to write -stringByAppendingFormat: which would -stringByAppendingFormat: a warning:
NSString *qFileTxtName = @"110327"; NSString *aString = [@"xxxx_" stringByAppendingFormat:qFileTxtName];
If you really wanted to use -stringByAppendingFormat: you need to do something like this:
NSString *aString = [@"xxxx_" stringByAppendingFormat:@"%@", qFileTxtName];
The following log calls show another operation that will trigger this warning from the compiler and a better (more secure) way to encode it:
NSLog(aString); // warning: format not a string literal and no format arguments NSLog(@"%@", aString); // the more secure way to do it
source share