title: Do I have to download all iCloud files to be able to generate their thumbnails?
body: <p>I am enumerating iCloud drive elements <code>NSMetadataItem</code> and storing them on an array.</p>
  <p>The files are there: confirmed by looking at the iCloud folder on OS X and also on the device using <code>UIDocumentPicker</code>.</p>
  <p>Later on the code I try to retrieve the thumbnails of such elements using:</p>
  <pre><code>// self.item is a NSMetadataItem
  NSURL *fileURL = [self.item valueForAttribute:NSMetadataItemURLKey];
  
  AVAsset *asset = [AVAsset assetWithURL:fileURL];
  AVAssetImageGenerator *generator = [[AVAssetImageGenerator alloc] initWithAsset:asset];
  generator.appliesPreferredTrackTransform = YES;
  
  CMTime time = CMTimeMakeWithSeconds(1, 60);
  
  AVAssetImageGeneratorCompletionHandler handler = ^(CMTime requestedTime, CGImageRef im, CMTime actualTime, AVAssetImageGeneratorResult result, NSError *error){
    if (result != AVAssetImageGeneratorSucceeded) {
      NSLog(@&quot;couldn't generate thumbnail, error:%@&quot;, error);
    }
    
    // TODO Do something with the image
  };
  
  generator.maximumSize = size;
  [generator generateCGImagesAsynchronouslyForTimes:@[[NSValue valueWithCMTime:time]]
                                  completionHandler:handler];
  </code></pre>
  <p>I receive this error inside the handler:</p>
  <blockquote>
  <p>couldn't generate thumbnail, error:Error Domain=NSURLErrorDomain
  Code=-1100 &quot;The requested URL was not found on this server.&quot;
  UserInfo={NSLocalizedDescription=The requested URL was not found on
  this server., NSUnderlyingError=0x15f82b2a0 {Error
  Domain=NSPOSIXErrorDomain Code=2 &quot;No such file or directory&quot;}}</p>
  </blockquote>
  <p>the problem is with the URL, you say, but the URL is extracted directly from the `NSMetadataItem&quot; and has the form</p>
  <blockquote>
  <p>file:///private/var/mobile/Library/Mobile%20Documents/iCloud~com~myCompany~myApp/Documents/0%20-%20intro.mov</p>
  </blockquote>
  <p>...in this case the movie is called <code>0 - intro.mov</code></p>
  <p>I have tried 3 other methods to download the thumbnails. None works.</p>
  <p><strong>Breakthrough</strong></p>
  <p>I have discovered now that I have to download all files that are on iCloud drive (using <code>startDownloadingUbiquitousItemAtURL:error:</code>) to the device to be able to generate their thumbnails, what seems to be insane. Imagine having several gigabytes of videos remotely and having to download all files just to show their thumbnails.</p>
  <p>It must exist another way. The proof is that the <code>UIDocumentPicker</code> shows the thumbnails of all videos that are on iCloud without downloading them.</p>
  <p>Any clues?</p>