IOS Alamofire使用get获取数据

2019-07-08 12:52:57 浏览数 (3)

代码语言:javascript复制
 65 @IBAction func touchupInsideGetRequestBtnAction( _
 sender:AnyObject) {
 66
 67 Alamofire.request(https://httpbin.org/get,
 method:.get, parameters:[“foo”:“bar”])
 68 .responseJSON { response in
 69 print(“original URL request:(response.request)”) //
 original URL request
 70 print(“URL response:(response.response)”) // URL
 response
 71 print(“server data:(response.data)”) // server data
 72 print(“result of response serialization:
 (response.result)”) // result of response serialization
 73
 74 if let JSON = response.result.value {
 75 print(“JSON:(JSON)”)
 76 }}
 77 }

0 人点赞