Forum Xamarin.iOS

PHImageManager stopped working

petros_sapetros_sa Member ✭✭
edited November 2019 in Xamarin.iOS

Hello, I have been using PHImageManager to get images from gallery linked in my app, as thumbnails that when you choose them they show up in the same view larger (kinda like instagram)

The problem here is that after updating to iOS 13.0+, I am getting a NullReferenceException, on this part:

manager.RequestImageData(fetchResult, highResolutionRequestOptions, (data, dataUti, orientation, info) =>
                    {
                        var path = (info?[(NSString)@"PHImageFileUTIKey"] as NSUrl).FilePathUrl.Path;
                        //Stream stream = System.IO.OpenRead((String)path);

                        photo.FilePath = path;
                    });

Has there been a change in the way I am getting the path that I am not aware off?

Best Answer

Answers

  • petros_sapetros_sa Member ✭✭
    edited November 2019

    Thank you very much, it worked fine, I just had to remove "file://" from "file:///var/mobile/Media/xxxxx" string I get from your Regex to get it actually display the image in the application. Thanks a lot!

  • petros_sapetros_sa Member ✭✭

    Update: After updating my NuGet packages from xamarin version 4.0.0.482894 to version 4.3.0.947036 to make my modals work properly, photos stopped working again, although I get the path "file:///var/mobile/Media/xxxxx" with the way you suggested, photos do not display, neither with "file://" in front of the path, neither without.

Sign In or Register to comment.