1

enter image description here

Here's the code I've tried so far:

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)
  }

This is the error I'm getting when trying the function below:

API route error - {
  ".tag" = path;
  path =   {
    ".tag" = "not_found";
  };
} 

NEW CODE

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)
      }
    }
  }
koen
  • 5,383
  • 7
  • 50
  • 89
Ufuk
  • 19
  • 3

1 Answers1

1

A path/not_found error indicates that there was nothing at the specified path, in this case "/AlloyTest/\(imageName)", in the connected Dropbox account. Make sure you provide the correct path.

For example, you can list the contents of any particular folder to get the correct path values of its contents using listFolder/listFolderContinue. The path for any particular returned item is Metadata.pathLower.

Greg
  • 16,359
  • 2
  • 34
  • 44
  • I tried that but I am still getting the same error. I edited my question and added some more information to make things clearer. – Ufuk May 26 '20 at 21:58
  • You might be using an app with the "app folder" [permission](https://www.dropbox.com/developers/reference/developer-guide#app-permissions), in which case your API calls will only operate inside the app folder for the app, by default at "/Apps/". You can use a path value of the empty string "" to list the root that your app has access to. If you need to access non-app folder locations, you'll need to [register](https://www.dropbox.com/developers/apps/create) a "full Dropbox" app instead. – Greg May 27 '20 at 13:29