title: PHCachingImageManager returns NSError for iCloud images
body: <p>I have an app in which I retrieve and display images from the iDevice. I use the following code:</p>
  
  <pre><code>PHImageRequestOptions *options = [[PHImageRequestOptions alloc] init];
  options.resizeMode = PHImageRequestOptionsResizeModeNone;
  options.deliveryMode = PHImageRequestOptionsDeliveryModeHighQualityFormat;
  options.networkAccessAllowed = YES;
  
  PHCachingImageManager *manager = [[PHCachingImageManager alloc] init];
  [manager requestImageForAsset:asset
                     targetSize:CGSizeMake(asset.pixelHeight, asset.pixelWidth)
                    contentMode:PHImageContentModeAspectFit
                        options:options
                  resultHandler:^(UIImage *result, NSDictionary *info) {
                     // Do something with the result
                  }];
  </code></pre>
  
  <p>My problem is that when the image I am trying to retrieve is not on the user's device, but only on iCloud (Settings -> iCloud -> Photos -> Optimise iPhone Storage), the requestImageForAsset: returns nil as result and the following NSError:</p>
  
  <pre><code>NSError *   domain: @"NSCocoaErrorDomain" - code: 18446744073709551615
  </code></pre>
  
  <p>The <a href="https://developer.apple.com/library/prerelease/ios/documentation/Photos/Reference/PHCachingImageManager_Class/index.html" rel="nofollow">documentation</a> for PHCachingImageManager says that:</p>
  
  <blockquote>
    <p>When you need an image for an individual asset, call the
    requestImageForAsset:targetSize:contentMode:options:resultHandler:
    method, and pass the same parameters you used when preparing that
    asset.</p>
    
    <p><strong>If the image you request is among those already prepared, the
    PHCachingImageManager object immediately returns that image.
    Otherwise, Photos prepares the image on demand and caches it for later
    use.</strong></p>
  </blockquote>
  
  <p>So in theory my code should work. Any ideas what might be causing this? </p>