简体   繁体   English

Dropbox-iOS- Swift 3:无法获取缩略图

[英]Dropbox - IOS- Swift 3 : Cannot get the thumbnail image

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: 但是,当我尝试使用以下方法获取缩略图时出现错误。我不知道我应该返回哪个URL:

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? 更新:我们不能在IOS中获取DROPBOX图像的缩略图URL吗?

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. 如果要使用API v2 Swift SDK在Dropbox中获取文件的缩略图,则使用getThumbnail方法之一是正确的方法。

For getThumbnail(path:format:size:overwrite:destination:) , note that this will write the thumbnail data to the URL you specify. 对于getThumbnail(path:format:size:overwrite:destination:) ,请注意,这会将缩略图数据写入您指定的URL。 (Ie, it doesn't provide an Internet-accessible URL where the thumbnail data is hosted.) (即,它不提供托管缩略图数据的可通过Internet访问的URL。)

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. getThumbnail(path:format:size:overwrite:destination:)方法是一种下载样式的请求,因此,应按照自述文件中“ Download to URL”示例中的“ Download-style request”下的说明使用它。

The getThumbnail(path:format:size:) method will return the thumbnail data in memory. getThumbnail(path:format:size:)方法将返回内存中的缩略图数据。 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. 无论哪种情况,请注意,您得到的path/not_found错误是指您提供的path: filename参数。 That is, there is nothing found at that path in the Dropbox account. 也就是说,在Dropbox帐户的该路径中找不到任何内容。 You should specify the remote Dropbox path of the file that you want a thumbnail for. 您应该指定要为其创建缩略图的文件的远程Dropbox路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM