美文网首页
Alamofire4.9.1 使用

Alamofire4.9.1 使用

作者: Matsonga | 来源:发表于2020-10-22 16:53 被阅读0次
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编码的数据
            }
        }

相关文章

网友评论

      本文标题:Alamofire4.9.1 使用

      本文链接:https://www.haomeiwen.com/subject/qvhpmktx.html