简体   繁体   English

编码url字符串(如果包含以下字符串)

[英]encoding an url string if it contans the following string

I am using the code like 我正在使用类似的代码

searchQuery =  [searchQuery stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
NSString* urlString = [NSString stringWithFormat:@"http://google.com/#auto|en|%@", searchQuery];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];

The code is run when I pressed a button app not open the browser, if I remove the last phrase "#auto|en|" 如果我删除了最后一个短语“ #auto | en |”,则当我按下按钮应用程序时,如果不打开浏览器,则代码将运行 it is working fine. 它工作正常。 How I can encode the string to give an url. 我如何编码字符串以提供网址。

检查searchQuery是否不接受您的任何此类参数..或提供更多说明,以便其他人可以对此做出适当的响应。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM