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??
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.