开发者

Warning message when launch a map by UIApplication sharedApplication

开发者 https://www.devze.com 2023-04-10 13:29 出处:网络
I link the following openMap method to a button. The method does work but there is an error message at

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

精彩评论

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

关注公众号