ios Alamofire网络插件的使用

pod ‘Alamofire‘

 

import Alamofire

let headers:HTTPHeaders = [ "aa":"bb"]let parameters = [ "name":"test"] request(url, method: .get, parameters: parameters, encoding: URLEncoding.default, headers: headers).responseJSON {(result) in if(result.result.isFailure){ print("请求出错") return } if let value = result.result.value { print(value) } else { print("请求出错") }}

 

相关文章