gpt4 book ai didi

ios - 如何从服务器URL下载zip文件并提取zip文件保存到ios swift中的本地目录?

转载 作者:行者123 更新时间:2023-12-01 17:03:27 24 4
gpt4 key购买 nike

我正在尝试下载zip文件并解压缩zip文件并保存到本地目录。当用户返回并检查解压缩后的文件在本地目录中是否可用。

在这里,我正在使用alamofire下载zip文件:

func zipFileApiCall() {
let aString = fullFormKey
let result = String((aString?.dropFirst(6))!)
let s = String(result.dropLast(10))
print("newFormKey", s )
let vKey = self.convap(text: s)
let newString = vKey.replacingOccurrences(of: ":", with: "/", options: .literal, range: nil)
print("full form key string /", newString )
let v = "https://storage.url.com"+newString+"/assets.zip"
let destination = DownloadRequest.suggestedDownloadDestination(for: .documentDirectory)
AF.request(v).validate().responseJSON { response in
debugPrint(response)
switch response.result {
case .success:
print("save form zip", response.value ?? "")
case .failure(let error):
print("Error:", error)
}
}
}

最佳答案

您可以使用此仓库解压缩文件:
https://github.com/weichsel/ZIPFoundation

关于ios - 如何从服务器URL下载zip文件并提取zip文件保存到ios swift中的本地目录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60112065/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com