Alamofire4.9.1 使用

Alamofire.request("https://httpbin.org/get").responseJSON { response in print("Request: \(String(describing: response.request))") // // 原始的請求 print("Response: \(String(describing: response.response))") // http 請求響應 print("Result: \(response.result)") // 響應結果標識 if let json = response.result.value { print("JSON: \(json)") // JSON序列化的數據 } if let data = response.data, let utf8Text = String(data: data, encoding: .utf8) { print("Data: \(utf8Text)") // 經過UTF-8編碼的數據 } }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章