How can i display only limited photos with PHPickerViewController?

Hello everyone!

I use Limited Photos Library feature and have selected a few photo but when use PHPickerViewController to select images in the application, PHPickerViewController shows all images in the gallery instead of just a few selected ones before.

Is it possible to display only pre-selected images in PHPickerViewController?
If not, how to display a list of pre-selected images so that the user can choose as UIImagePickerController before.

Thanks to everyone for sharing and commenting
ミ★(=^・・^)v Thanks!!★彡

Replies

Same questions here
Currently it's not possible, please file an enhancement request if you want us to support it.

We would also like to know why you want to use the limited library picker with PHPicker instead of only using PHPicker.
Did anyone manage to display only the limited "pre-selected" images?
It seems that from version ios 14 onwards, when the application opens the photo library, there will be 3 requests for access, namely "A - Select Photos ..." and "B - Allow Access to All Photos" and "C - Don't Allow ".

So regardless of the option, PHPickerViewController also displays all images in the gallery, so it seems to be difficult for the user to experience.
If you can manage the display of the pre-selected image, that's great.

In addition, my application wants to get more information about the image so if the user unfortunately chooses the "no pre-selected" images, the result of the fetchResult array will have no elements.

Code Block
func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
picker.dismiss(animated: true)
let identifiers = results.compactMap(\.assetIdentifier)
let fetchResult = PHAsset.fetchAssets(withLocalIdentifiers: identifiers, options: nil)
// TODO: Do something with the fetch result if you have Photos Library access
}