title: Check if photo still exists in camera roll after restart ios app
body: <p>I'm still new in iOS development and I'm creating an app that allows to select some photos and access them quickly. 
  In CoreData, I store the referenceUrl of the photo instead of the photo itself. I'm able to load photos when starting the app this way.</p>
  
  <p>But, before loading photos, I need to check that they still exist and cannot figure out how to check, using the referenceUrl, if a photo exists or not.</p>
  
  <p>Even using the localPath does not work. It returns false all the time.</p>
  
  <p>If you have any idea how I can proceed, I'll be very grateful.
  Thanks.</p>
  
  <pre><code>func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
  
          let imageUrl          = info[UIImagePickerControllerReferenceURL] as! NSURL
          let imageName         = imageUrl.lastPathComponent
          let documentDirectory = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first!
          let photoURL          = NSURL(fileURLWithPath: documentDirectory)
          let localPath         = photoURL.appendingPathComponent(imageName!)!
          let localPathString   = String(describing: localPath)
  
          let fileManager = FileManager.default
          if fileManager.fileExists(atPath: localPathString){
              print ("Photo exists")
          } else{
              print ("Photo does not exist")
          }
  }
  </code></pre>