//
當客戶端接收到服務端的響應時,會呼叫這個方法
-(void)connection:(nsurlconnection *)connection didreceiveresponse:(nsurlresponse *)response{
//狀態碼
的屬性
繼承自nsurlresponse
//狀態碼:
200 -->
請求成功
// 404 -->
在伺服器中不存在要請求的資源
// 400 -->
客戶端錯誤
// 500 -->
服務端錯誤
[_mutabledata
setlength:0];
網路請求 NSURLConnection
http和https http協議,hyper transfer protocol 超文字傳輸協議 是用於全球資訊網 www 伺服器傳送超文字到本地瀏覽器的傳輸協議,http是乙個應用層協議,由請求和響應構成,是乙個標準的客戶端伺服器模型.工作原理 http協議採用請求 響應模型.客戶端向伺服器傳送...
NSURLConnection 非同步請求
匯入第三方庫svprogresshud import viewcontroller.h import svprogresshud.h import mjrefresh.h inte ce viewcontroller property retain nsmutablearray datasource...
NSURLConnection同步與非同步請求
非同步請求 nsmutabledata buf nsmutabledata alloc initwithlength 0 nsurlconnection connection nsurlconnection alloc initwithrequest req delegate self 收到響應時,...