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
You can try this for iOS 11
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
if let asset = info[UIImagePickerControllerPHAsset] as? PHAsset {
if let fileName = (asset.value(forKey: "filename")) as? String {
//Do your stuff here
}
}
picker.dismiss(animated: true, completion: nil)
}
Make sure you add this NSPhotoLibraryUsageDescription to your Infor.plist