开发者

Warning message when launch a map by UIApplication sharedApplication

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 ;-)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜