PHPickerViewController in limited library mode

In the case where an app uses the Photo Library to reload images by using a fetchRequest with localIdentifier there is hole in the following guidance in WWDC21 "Improve access to Photos in your app"

"When the picker session is completed, selected photos will be returned to your app. Suppose the configuration is initialized with a PHPhotoLibrary object, picker results will contain both item providers and asset identifiers. Your app can use the item provider to load and display selected photos."

The picker result providers do not load the image if the image is not in the limited library list, even though the user has selected them with the PHPicker.

It looks like the workaround is to raise a user error that the image is not loaded because it is not in the limited selection, then do the PHPhotoLibrary.shared().presentLimitedLibraryPicker so the limited selection is the way the user wants it.

This workaround seems like an awful thing to do to the user since they have to pick the same photo(s) twice..

Also - this scenario works fine with the PHPickerDemo because privacy setting for the demo is not added in settings.. Presumably because PHPickerDemo is not directly using the PhotoKit API methods.

Any thoughts or workaround alternatives that you see? Or raise a bug?

Thanks!!

Replies

Limited Library will not be automatically extended when items are selected using PHPickerViewController.

You should still be able to access image data using the returned NSItemProvider provided in the PHPickerResult object.