这仅在iOS 8上显示。对于早期版本,它没有问题。NSMutableURLRequest仅在iOS中为url添加附加标头8
实例:
对于iOS 7.1:
NSString *url = @"http://www.example.com/api/search?name=test&page=1";
NSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc] init];
[urlRequest setURL:[NSURL URLWithString:url]];
获取urlRequest
作为
<NSMutableURLRequest: 0x7b787130> { URL: http://www.example.com/api/search?name=test&page=1 }
对于iOS 8.0:
NSString *url = @"http://www.example.com/api/search?name=test&page=1";
NSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc] init];
[urlRequest setURL:[NSURL URLWithString:url]];
获取urlRequest
如
<NSMutableURLRequest: 0x7b6246d0> { URL: http://www.example.com/api/search?name=test&page=1, headers: (null) }
错误适用于iOS 8.0:Error 400 (Bad Request)
什么是实际的错误?这些消息似乎并不是说任何事情都是错的。 – 2014-09-19 14:39:22
获取
您是否能够在服务器端捕获完整的URL并向我们展示其差异? – trojanfoe 2014-09-20 09:48:38