Dropbox API 使用SwiftyDropbox库下载处理了所有错误情况的文件
示例
Dropbox.authorizedClient!.files.download(path: path, destination: destination).response { response, error in
if let (metadata, url) = response {
print("*** Download file ***")
print("Downloaded file name: \(metadata.name)")
print("Downloaded file url: \(url)")
} else if let callError = error {
switch callError as CallError {
case .RouteError(let boxed, let requestId):
print("RouteError[\(requestId)]:")
switchboxed.unboxedasFiles.DownloadError{
case .Path(let fileLookupError):
print("PathError: ")
switch fileLookupError {
case .MalformedPath(let malformedPathError):
print("MalformedPath: \(malformedPathError)")
case .NotFile:
print("NotFile")
case .NotFolder:
print("NotFolder")
case .NotFound:
print("NotFound")
case .RestrictedContent:
print("RestrictedContent")
case .Other:
print("Other")
}
case .Other:
print("Other")
}
case .BadInputError(let message, let requestId):
print("BadInputError[\(requestId)]: \(message)")
case .HTTPError(let code, let message, let requestId):
print("HTTPError[\(requestId)]: \(code): \(message)")
case .InternalServerError(let code, let message, let requestId):
print("InternalServerError[\(requestId)]: \(code): \(message)")
case .OSError(let err):
print("OSError: \(err)")
case .RateLimitError:
print("RateLimitError")
}
}
}
热门推荐
3 祝福语简短的微信
10 幼儿祝福语大全简短贺卡
11 感谢教官文案祝福语简短
12 鼠年同事祝福语简短创意
13 元旦祝福语 简短独特群发
14 妈咪跟我生日祝福语简短
15 给儿子新婚祝福语简短
16 伴娘祝福语长文案简短
17 恭喜高考完祝福语简短
18 生日祝福语送老公简短