我正在使用 Xamarin 将图像保存到 iPhone 的照片库中,我想获取这些图像的文件路径。
下面是允许我获取保存到应用程序 tmp 目录的图像路径的代码。
string filepath = Path.GetTempPath() + "test.png";
Image.Save(filepath);
Is there a way I can get the file path of an image saved to the photo library?
Image.ToUIImage().SaveToPhotosAlbum((image, error) => {
//GET THE FILE PATH OF image HERE
});
最佳答案
您无法使用普通文件 I/O 访问照片库。除了隐私问题之外,底层数据不一定存储在设备上。您必须使用照片框架和 PHAsset
/PHImageManager
和相关类。 This post显示了几个标准用例。
关于ios - Xamarin - 获取保存到照片库的图像的文件路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47209451/