[英]Alamofire.request "Extra argument 'method' in call"
I have the error above on the first request and I already tried to change the return from URL
to URLConvertible
?我在第一个请求中URLConvertible
了上述错误,并且我已经尝试将返回值从URL
更改为URLConvertible
?
func baseUrlWith(string: String) -> URL {
return URL(string: Constants.Api.BaseUrl + string)!
}
func fetchVideosAlamofire(completion: @escaping ([Product]) -> ()) {
let url = URL(string: Constants.Api.BaseUrl + Constants.Api.Feed)
let url1 = baseUrlWith(string: Constants.Api.Feed)
Alamofire.request(url1!,
method: .get,
parameters: nil).validate().responseJSON
Alamofire.request(url!,
method: .get,
parameters: nil).validate().responseJSON
}
I'm using Alamofire 4.3.0我正在使用 Alamofire 4.3.0
Use a URLRequest
:使用URLRequest
:
var request = URLRequest(url: url!)
request.httpMethod = "GET"
Alamofire.request(request)
.validate()
.responseJSON { (response) in
//
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.