我正在尝试使用 SwiftyDropbox 下载文件,但路径有问题。我在 mi Dropbox “prueba.txt”中有一个文件:
这是我用来在我的应用程序中下载的代码。
import UIKit
import SwiftyDropbox
let clientDB = DropboxClientsManager.authorizedClient
class Controller: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
DropboxClientsManager.authorizeFromController(UIApplication.shared, controller: self, openURL: {
(url: URL) -> Void in UIApplication.shared.open(url)
})
let fileManager = FileManager.default
let directoryURL = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0]
let destURL = directoryURL.appendingPathComponent("/test.txt")
let destination: (URL, HTTPURLResponse) -> URL = { temporaryURL, response in
return destURL
}
clientDB?.files.download(path: "/prueba.txt", overwrite: true, destination: destination)
.response{ response, error in
if response != nil{
self.cargarDatosCliente()
//print (response)
} else if let error = error{
print (error)
}
}
.progress{ progressData in
print(progressData)
}
}
}
我尝试了不同的方法,但总是用“路径”得到相同的问题,总是错误是path/not_found/...
我尝试使用其他路径但同样的问题。你可以帮帮我吗?我的错误在哪里?
谢谢!