0

I am trying to populate my collection view with images from the dropbox.

I want to have the thumbnail image for my grid view (collection view) with the following code.

DropboxClientsManager.authorizedClient?.files.getThumbnail(path: filename).response(completionHandler: { (
            response, error) in

            print(response)
            print(error)

})

I get the following error:

Optional([request-id e70dba3b7ee8f0b9bf6b0aa4b19325f0] API route error - {
".tag" = path;
path =     {
    ".tag" = "not_found";
};
})

But when I try to getthumbnail using this following method I get error .I don't know which url i should return to this function:

DropboxClientsManager.authorizedClient?.files.getThumbnail(path: filename, format: .png, size: .w32h32, overwrite: true, destination: { (url, res) -> URL in

            print(url)
            print(res)
            return url
        })

UPDATE: CAN'T WE GET THUMBNAIL URL FOR DROPBOX IMAGES IN IOS?

Does anyone has the solution ?

Any suggestions??

user3804063
  • 809
  • 1
  • 14
  • 32

1 Answers1

1

If you want to get a thumbnail for a file in Dropbox using the API v2 Swift SDK, using one of the getThumbnail methods is the correct approach.

For getThumbnail(path:format:size:overwrite:destination:), note that this will write the thumbnail data to the URL you specify. (I.e., it doesn't provide an Internet-accessible URL where the thumbnail data is hosted.)

The getThumbnail(path:format:size:overwrite:destination:) method is a download-style request, so you should use it as shown under "Download-style request" in the readme, per the "Download to URL" example.

The getThumbnail(path:format:size:) method will return the thumbnail data in memory. You would use it as shown under "Download-style request" in the readme, per the "Download to Data" example.

In either case, note that the path/not_found error you're getting is referring to the path: filename parameter you're supplying. That is, there is nothing found at that path in the Dropbox account. You should specify the remote Dropbox path of the file that you want a thumbnail for.

Greg
  • 16,359
  • 2
  • 34
  • 44
  • Do you got sample code regarding using API v2 swift sdk? I am really blank on this . – user3804063 May 10 '17 at 05:10
  • 1
    There's a [sample app](https://github.com/dropbox/PhotoWatch) you can refer to, but it looks like you already managed to write the `getTemporaryLink` call, per [your new post](https://stackoverflow.com/questions/43890727/ios-collectionview-images-disappear-on-scrolling-and-sometimes-overlaps). – Greg May 10 '17 at 18:13
  • Thanks and a very big thanks . I can download the thumbnails of size 32*32 and of any size . Thank you so much for your precious time. But I have a problem , my collection view cell images disappear on scrolling . http://stackoverflow.com/questions/43890727/ios-collectionview-images-disappear-on-scrolling-and-sometimes-overlaps/43891043?noredirect=1#comment74818329_43891043 – user3804063 May 11 '17 at 15:07