Requesting image with Swift 3 results in "Creating an image format with an unknown type is an error"
<p>I have a controller in which I just fetch images in user's gallery and show them. It used to work with XCode 7.3, but after upgrading it to XCode 8.0 and updating the code for Swift 3.0 compatibility, it gives me a strange and very generic error:</p>

<blockquote>
  <p>Creating an image format with an unknown type is an error</p>
</blockquote>

<p>I am not able to figure out what is not working here. My code is the following:</p>

<pre><code>let imgManager = PHImageManager.default()  

let requestOptions = PHImageRequestOptions()  
requestOptions.isSynchronous = false  
requestOptions.deliveryMode = PHImageRequestOptionsDeliveryMode.fastFormat  

let fetchOptions = PHFetchOptions()  
fetchOptions.sortDescriptors = [NSSortDescriptor(key:"creationDate", ascending: false)]  

let fetchResult = PHAsset.fetchAssets(with: PHAssetMediaType.image, options: fetchOptions)  
if fetchResult.count &gt; 0 {  
  for i in 0...(fetchResult.count-1) {  
    imgManager.requestImage(for: fetchResult.object(at: i), targetSize: view.frame.size, contentMode: PHImageContentMode.aspectFit, options: requestOptions, resultHandler: { (image, _) in  
      // do some stuff  
      self.progressView.isHidden = true  
    })  
  }  
} else {  
  self.progressView.isHidden = true  
}  
</code></pre>

<p>In this code I removed the image visualization code for readability. The instruction that triggers the error is the "requestImage" one. Any help will be very appreciated.</p>