简体   繁体   中英

Xamarin - get file path of image saved to photo library

I am using Xamarin to save images to the iPhones photo library and I want get the file path of these images.

Below is the code that allows me to get the path of images saved to the applications tmp directory.

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
});

You cannot access the Photos library using normal File I/O. Beside the privacy concerns, the underlying data is not necessarily stored on the device. You have to use the Photos framework and PHAsset / PHImageManager and related classes. This post shows several standard use-cases.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM