搜尋

首頁  >  問答  >  主體

Objective-c - NSURLConnection

- (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
小白一枚,求大神告知,萬分感謝!!!

某草草某草草2834 天前553

全部回覆(1)我來回復

  • PHP中文网

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

    那是報頭,每個報文都有,content-length = 0 說明沒有資料。你這確定請求成功了嗎?

    回覆
    0
  • 取消回覆