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("请求出错") } }