Reputation: 187
I have a call to the method
[NSAlert alertWithMessageText:string1 defaultButton:@"OK" alternateButton:@"" otherButton:@"" informativeTextWithFormat:infoString]
I need my infoString to be a string variable and that's how I have it set up. However, I am getting a warning saying "Format string is not a string literal (potentially insecure)."
I tried googling to find an answer, but none of the suggestions I found worked in my case. I tried replacing infoString with:
[NSString stringWithString:infoString];
and
[NSString stringWithFormat:@"%@", infoString];
I can't find a way to get rid of this warning. Any suggestions are welcome and helpful.
Thanks!
Upvotes: 1
Views: 735
Reputation: 22701
The informativeTextWithFormat
is expecting a format string, which should be a constant for security reasons.
For a simple fix, change to this:
[NSAlert alertWithMessageText:string1
defaultButton:@"OK"
alternateButton:@""
otherButton:@""
informativeTextWithFormat:@"%@", infoString];
Upvotes: 2