在我的项目中,我使用的是 Alamofire 5.9.3,以下是将数据上传到服务器。
APISessionController.sharedInstance.sessionManager().upload(multipartFormData: { (multipartFormData) in
for (key, value) in parameters {
multipartFormData.append(value.data(using: String.Encoding.utf8)!, withName: key)
}
}, to:url)
{ (result) in
switch result {
case .success(let upload, _, _): // Getting Error: '_' can only appear in a pattern or on the left side of an assignment
upload.uploadProgress(closure: { (Progress) in
self.delegate.uploadProgress(Progress.fractionCompleted)
})
upload.responseJSON { response in
if let JSON = response.result.value as? Dictionary<String, AnyObject> {
}
case .failure(_): //Getting Error : '_' can only appear in a pattern or on the left side of an assignment
Previoulsy 我使用的是 Alamofire 4.9.1,它工作正常。但它在 Alamofire 5 中显示错误?