title: UIImagePickerControllerDelegate get date from picked image in iOS 11
body: <p><code>UIImagePickerControllerReferenceURL</code> was deprecated in iOS 11 (even though it's still returned in the <code>info</code> dictionary) and was supposed to be replaced with <code>UIImagePickerControllerPHAsset</code>, but I've yet to get an <code>info</code> dictionary back which contains that key. Since the one is deprecated and the other is missing, is there a known solution for extracting the "date taken" from the picked image?</p>
  
  <p>For reference, this is an example <code>info</code> dictionary returned when and image is picked from the library:</p>
  
  <pre><code>▿ 4 elements
    ▿ 0 : 2 elements
      - key : "UIImagePickerControllerImageURL"
      - value : file:///private/var/mobile/Containers/Data/Application/EE1BA60E-2DC3-47C5-A58D-86498E95C323/tmp/3A025D4C-B378-474B-8A09-017479A3A776.jpeg
    ▿ 1 : 2 elements
      - key : "UIImagePickerControllerMediaType"
      - value : public.image
    ▿ 2 : 2 elements
      - key : "UIImagePickerControllerReferenceURL"
      - value : assets-library://asset/asset.HEIC?id=537976CD-A550-41C9-9416-92C8072112D7&amp;ext=HEIC
    ▿ 3 : 2 elements
      - key : "UIImagePickerControllerOriginalImage"
      - value : &lt;UIImage: 0x1d04b4760&gt; size {3024, 4032} orientation 3 scale 1.000000
  </code></pre>
  
  <p>(Note that <code>UIImagePickerControllerReferenceURL</code> is still present, though deprecated, and the suggested replacement, <code>UIImagePickerControllerPHAsset</code>, is missing.)</p>
  
  <p><em>If it were present</em>, getting the date would be simple:</p>
  
  <pre><code>if let asset = info[UIImagePickerControllerPHAsset] as? PHAsset,
      let resource = PHAssetResource.assetResources(for: asset).first {
      let dateTaken = resource.creationDate
  }
  </code></pre>
  
  <p>Could it be that Apple forgot to implement <code>UIImagePickerControllerPHAsset</code>? Any ideas on workarounds (without using deprecated methods)?</p>
  
  <h2>Note on possible duplicates</h2>
  
  <p>I believe that previous solutions on Stack Overflow are deprecated, and thus won't answer the question using modern approaches.</p>