ios - Swift:从DropBox下载图像

标签 ios swift dropbox dropbox-api swiftydropbox

enter image description here

这是到目前为止我尝试过的代码:

client?.files.download(path: "/AlloyTest/\(imageName)").response { response, error in
    if let response = response {
      let responseMetadata = response.0
      print(responseMetadata)
      let fileContents = response.1
      print(fileContents)
    } else if let error = error {
      print(error)
    }
  }
  .progress { progressData in
    print(progressData)
  }

这是尝试以下功能时遇到的错误:
API route error - {
  ".tag" = path;
  path =   {
    ".tag" = "not_found";
  };
} 

新密码
func getImage(imageName: String, completion: @escaping (UIImage, NetworkingError) -> ()) {
    // Get Image from dropbox
    // Download to Data
    client?.files.listFolder(path: "/AlloyTest").response { response, error in
      if let response = response {
        let entries = response.entries
        print("ENTRIES:", entries)
      } else if let error = error {
        print(error)
      }
    }
  }

最佳答案

A path/not_found error表示连接的Dropbox帐户中的指定路径(在本例中为"/AlloyTest/\(imageName)")没有任何内容。确保提供正确的路径。

例如,您可以使用 listFolder / listFolderContinue 列出任何特定文件夹的内容,以获得其内容的正确路径值。任何特定返回项目的路径为 Metadata.pathLower

关于ios - Swift:从DropBox下载图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62027757/

相关文章:

iOS 在整个应用程序中存储 'access_token'

iphone - 动态本地化应用程序内部的 iOS 应用程序?

ios - 我正在尝试缩进表格 View 单元格文本标签的右边距

ios - 使用未声明的类型 'Date' Xcode 9 Swift 4

curl - 使用Curl和Oauth 2将文件上传到DropBox的DropBox API PUT示例

Dropbox 选择性同步 - 模式匹配?

ios - UICollectionView 两个具有相同 View 的单元格。第二个单元格什么也没显示

xcode - Xcode 和 IOS 设备上的栏按钮项目颜色不同

ios - 控制 collectionView 从 collectionView Cell 中滚动

dropbox - 重命名 Dropbox 应用文件夹?