objective-c - NSURLConnection

浏览:55日期:2023-11-28

问题描述

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{ NSLog(@'%@----%@-----%@---%@',connection.currentRequest.URL,connection.currentRequest.HTTPBody,connection.currentRequest.HTTPMethod,connection.currentRequest.allHTTPHeaderFields);}

输出结果如下http://这里是网址/zines----(null)-----GET---{

Accept = 'application/json';'Content-Length' = 0;'Content-Type' = 'application/json';

}为什么用 xcode 就可以得到数据,放到浏览器里就是'Internal Server Error'浏览器输入的地址如下:http://这里是网址/zines小白一枚,求大神告知,万分感谢!!!

问题解答

回答1:

那是报头,每个报文都有,content-length = 0 说明没有数据。你这确定请求成功了吗?

相关文章: