search

Home  >  Q&A  >  body text

objective-c - NSURLConnection

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

The output results are as follows
http://这里是网址/zines----(null)-----GET---
{

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

}
Why can I get the data using xcode? When I put it in the browser, it will show "Internal Server Error". The address entered by the browser is as follows: http://这里是网址/zines
I am a novice, please let me know. Thank you very much. !!!

某草草某草草2840 days ago559

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-05-02 09:28:12

    That is the header, every message has it, content-length = 0 means there is no data. Are you sure your request was successful?

    reply
    0
  • Cancelreply