I want to get the file name from UIImagePickerController. I do not want to use ALAssetLibrary because it is deprecated in iOS 9. I have used the following code
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
if let asset = PHAsset.fetchAssets(withALAssetURLs: [info[UIImagePickerControllerReferenceURL] as! URL],options: nil).firstObject {
var resources = PHAssetResource.assetResources(for: asset)
let orgFilename: String = ((resources[0] as? PHAssetResource)?.originalFilename)!
print("filename:",orgFilename)
}
}