你好,我有这个代码
NSLog(@"%@",URLRequestQueryString);
NSString *sendToServerString = [NSString stringWithFormat:@"http://mydomain.co.uk/req.php%@",URLRequestQueryString];
NSURL *sendToServer = [[NSURL alloc] initWithString:sendToServerString];
NSLog(@"%@",sendToServer);
NSLog(@"%@",sendToServerString);
URLRequestQueryString 只是我在整个脚本中构建的标准查询字符串。
第一个 NSLog 工作正常并输出正确的查询字符串(如果我将其复制并粘贴到浏览器中,则页面将正确加载并运行。
当我输出sendToServerString
它正确输出带有查询字符串的 URL 时也是这种情况(我也可以将其复制并粘贴到浏览器中)。
但是sendToServer
输出(空)。如果我删除查询字符串,它将正确输出域和路径。
知道为什么会这样吗?我该如何排序?
谢谢你。