iOS Dropbox获取缩略图图像

时间:2015-08-17 13:41:30

标签: ios swift thumbnails dropbox

我正在尝试加载Dropbox帐户的缩略图图片,但我收到了一个错误。我在第一个放置缩略图的方法中创建了一个本地目录,并且我发出了加载它们的请求,但它不起作用。

这是我的代码:

// Create directory method 
func createTempDirectory() -> String? {

    let tempDirectoryTemplate = NSTemporaryDirectory()
    tempDirectoryTemplate.stringByAppendingPathComponent("XXXXX")

    let fileManager = NSFileManager.defaultManager()

    var err: NSErrorPointer = nil
    if fileManager.createDirectoryAtPath(tempDirectoryTemplate, withIntermediateDirectories: true, attributes: nil, error: err) {
        return tempDirectoryTemplate
    }
    else {
        return nil
    }
}

// Get thumbnails images 
func restClient(client: DBRestClient!, loadedMetadata metadata: DBMetadata!) {

    temporaryDirectory = createTempDirectory()!

    for file in metadata.contents {
        if (file.thumbnailExists == true) {
            client.loadThumbnail(file.path, ofSize: "s", intoPath: temporaryDirectory)
        }
    }

    self.collectionView?.reloadData()
}

这就是错误:

[WARNING] DropboxSDK: error making request to /1/thumbnails/dropbox/star.jpg - (4) Error Domain=NSCocoaErrorDomain Code=4 "The operation couldn’t be completed. (Cocoa error 4.)

感谢您的帮助!

0 个答案:

没有答案