【发布时间】:2021-04-02 15:47:51
【问题描述】:
我正在开发一个 iOS 应用程序。在应用程序中,我使用 Alamofire 创建一个 POST 请求,该请求返回一个原始 PDF 文件作为响应。现在,我可以保存文件并使用UIDocumentInteractionController 打开它。但是,我希望文件保留在用户的文档文件夹中。
以下是我创建目标路径的方法:
let destination: DownloadRequest.DownloadFileDestination = { _, _ in
let documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
let fileURL = documentsURL.appendingPathComponent("Dividend Summary Report.pdf")
return (fileURL, [.removePreviousFile, .createIntermediateDirectories])
}
请有人告诉我我的逻辑有什么问题以及我可以做些什么来纠正它。
【问题讨论】:
标签: ios swift pdf post alamofire