PHPickerViewController getting error on selecting first image from simulator

I am getting the below error on selecting the first image from the simulator photo library.

for itemProvider in parent.itemProviders {
    if itemProvider.canLoadObject(ofClass: UIImage.self) {
        itemProvider.loadObject(ofClass: UIImage.self) { (image, error) in
            if let image = image as? UIImage {
            } else {
                print("Could not load image", error?.localizedDescription ?? "")

When I select the first image I am getting the below error
Cannot load representation of type public.jpeg

Also, how can I persist the selection when I open the photo library again?

Terms of Service

Privacy Policy

Cookie Policy