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")
}
}
}
热门推荐
10 新年门口花束祝福语简短
11 盘锦结婚祝福语大全简短
12 父母生日祝福语 简短独特
13 家庭恩爱祝福语简短英文
14 高考俄语祝福语大全简短
15 虎年祝福语 诗句唯美简短
16 生日婚礼祝福语简短精辟
17 虎年喝酒拜年祝福语简短
18 教师闺蜜祝福语简短