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开发者_如何学JAVA.google.com/maps?q=%@", addressText];
NSLog(urlText);
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlText]];
}
Change the NSLog to,
NSLog(@"%@", urlText);
Or, remove the NSLog completely ;-)
精彩评论