Do I have to download all iCloud files to be able to generate their thumbnails?

前端 未结 1 1648
耶瑟儿~
耶瑟儿~ 2021-02-04 21:16

I have read all answers on stack overflow about this error and none solved the case, because my question is a little different.

I am enumerating iCloud drive elements

相关标签:
1条回答
  • 2021-02-04 21:23

    I think the issue is arising due to permissions to read the files after the URL's have been found. Per this answer, however, you should be able to do it with the following:

    [url startAccessingSecurityScopedResource];
    
    NSFileCoordinator *coordinator = [[NSFileCoordinator alloc] init];
    __block NSError *error;
    [coordinator coordinateReadingItemAtURL:url options:0 error:&error byAccessor:^(NSURL *newURL) {
        [newURL getResourceValue:&image forKey:NSURLThumbnailDictionaryKey error:&error];
    }];
    
    [url stopAccessingSecurityScopedResource];
    
    0 讨论(0)
提交回复
热议问题