你如何从 UIImagePickerController 获取图像文件名? [英] How do you get image file name from UIImagePickerController?

查看:44
本文介绍了你如何从 UIImagePickerController 获取图像文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有从照片库中获取图像名称.这里有人知道获取图像名称的正确方法吗?

I'm not getting the image name from photo library. Anyone here knows a proper way to get image name?

注意:PHAsset.fetchAssets(withALAssetURLs: [imageURL], options: nil) 已弃用.

仅限 Swift

谢谢

推荐答案

我找到了方法

if let asset = info["UIImagePickerControllerPHAsset"] as? PHAsset{
            if let fileName = asset.value(forKey: "filename") as? String{
            print(fileName)
            }
        }

这将返回照片库中的实际文件名.

This will return you the actual file name in the photo library.

这篇关于你如何从 UIImagePickerController 获取图像文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆