我正在使用以下代码片段实现搜索。
-(void)getData:(NSString *)searchString
{
//Search string is the string the user keys in as keywords for the search. In this case I am testing with the keywords "epic headline"
searchString = [searchString stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString *resourcePath = [NSString stringWithFormat:@"/sm/search?limit=100&term=%@&types[]=users&types[]=questions&types[]=topics",searchString];
[self sendRequests:resourcePath];
}
//URL sent to server as a result
send Request /sm/search?limit=100&term=epic headline&types[]=users&types[]=questions&types[]=topics
我的搜索不起作用,因为它无法处理“史诗”和“标题”之间的空格。如何修改搜索词以便处理间距?