objective c - NSRunAlertPanel + format string is not a string literal (potentially insecure) -
ok, know format string not string literal warning, don't know why appearing on nsrunalertpanel, definition is:
appkit_extern nsinteger nsrunalertpanel(nsstring *title, nsstring *msgformat, nsstring *defaultbutton, nsstring *alternatebutton, nsstring *otherbutton, ...) ns_format_function(2,6);
when reporting errors pass error.localizeddescription on message, example:
nsrunalertpanel(@"error", err.localizeddescription, @"ok",nil,nil); but after upgrading xcode 5.1, started getting warnings.
so tried this:
nsrunalertpanel(@"error", [nsstring stringwithformat:@"%@", err.localizeddescription], @"ok", nil, nil); and same situation. has ideas on how fix ?
msgformat message format string , should string literal. necessary arguments added "variable argument list" after otherbutton. example
nsrunalertpanel(@"error", @"%@", @"ok", nil, nil, err.localizeddescription); message format---^ arguments---^
Comments
Post a Comment