我是 Alamofire 的新手(以及一般的 Swift)。我需要获得实时上传进度。如何做到这一点?
在这里,我上传了多个 PDF 文档:
AF.upload(multipartFormData: { multipartFormData in
for f in files{
multipartFormData.append(f.data, withName: "files", fileName: f.name, mimeType: "application/pdf")
}
}, to: "http://localhost:8080/api/v1/documents")
.uploadProgress { progress in
print("Upload Progress: \(progress.fractionCompleted)")
}
这里它只输出,这不是我所期望的
Upload Progress: 1.0
那么这个文件是在说谎吗?https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#upload-progress