這僅在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