我建议您使用
Photosframework来获取图像的名称,下面是获取所选图像名称的代码
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { if let imageURL = info[UIImagePickerControllerReferenceURL] as? URL { let result = PHAsset.fetchAssets(withALAssetURLs: [imageURL], options: nil) let asset = result.firstObject print(asset?.value(forKey: "filename")) } dismiss(animated: true, completion: nil)}


