我刚开始 iOS 开发,我正在使用 Dropbox API 和 SwiftyDropbox。我正在尝试将文本文件上传到 Dropbox,但出现以下错误:
无法使用类型为“(路径:字符串)”的参数列表调用“上传”
这是我的代码。我究竟做错了什么?
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
if let authResult = DropboxClientsManager.handleRedirectURL(url) {
switch authResult {
case .success:
print("Logged into Dropbox successfully.")
case .cancel:
print("Authorization canceled.")
case .error(_, let description):
print("Error: \(description)")
}
let client = DropboxClientsManager.authorizedClient
client.files.upload(path: "/hello.txt").response { response, error in
if let metadata = response {
println("Uploaded file name: \(metadata.name)")
println("Uploaded file revision: \(metadata.rev)")
let client = DropboxClientsManager.authorizedClient
client?.files.createFolderV2(path: "/Auction_Upload").response { response, error in
if let response = response {
print(response)
} else if let error = error {
print(error)
}
}
}
return true
}