0

I link the following openMap method to a button. The method does work but there is an error message at

NSLog(urlText);

The message shows format string is not a literal (potentially insecure). Does anyone know how to eliminate this warning?

-(IBAction)openMap:(id)sender{
    NSString* addressText = @"New York";
    addressText =  [addressText stringByAddingPercentEscapesUsingEncoding: NSASCIIStringEncoding];
    NSString* urlText = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@", addressText];
    NSLog(urlText);
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlText]];
}
hitheredude
  • 929
  • 5
  • 18
  • 32
  • The question you have asked in your body is totally different from the question title. Please make sure you change the question title for correct future reference. :) – Nitish Oct 05 '11 at 06:14
  • possible duplicate of [Warning: "format not a string literal and no format arguments"](http://stackoverflow.com/questions/1677824/) – jscs Oct 05 '11 at 06:45
  • Sorry! Thank you anyway. – hitheredude Oct 05 '11 at 06:50

1 Answers1

2

Change the NSLog to,

NSLog(@"%@", urlText);

Or, remove the NSLog completely ;-)

EmptyStack
  • 51,274
  • 23
  • 147
  • 178