PHPickerResult slow loading, plus no thumbnails

A very common use case in our iOS app is that users take a large number of pictures (about 30) in low-light conditions using the camera app, and immediately after, they try to upload them to our servers.

We measured the time to load photos from the PHPickerResult. For most photos, it takes less than 100 milliseconds, but for some of them, it takes several seconds—we even saw minutes in some extreme cases.

We believe this started happening with iOS 17, when deferred photo processing was introduced. If users take the pictures using our in-app camera experience, the options to customize the camera are enough to avoid the long waiting times. However, the majority of our users still prefer to take the photos with the camera app, and there is little we can do about that.

In the past few weeks, we tried many combinations: Without asking for permissions, we tried loadFileRepresentation, loadData, and loadObject.

We explored the PHImageManager route, asking permissions and with different options for deliveryMode, resizeMode, version, isSynchronous, and allowSecondaryDegradedImage.

We also tried fetching the photos in parallel, with very bad results.

In summary, nothing helped the long waiting times—minutes in some cases.

The first question is then, is there anything we can do to ignore the post-processing of the photos and get them fast? We could accept the unprocessed images.

At a minimum, we would like to show our users what we are doing and why we are taking so much time. We tried to load thumbnails with loadPreviewImage and put a progress indicator on top. This method consistently gives us an error for all photos:

(lldb) p error.localizedDescription
(String) "Cannot load preview."

We can load thumbnails with the PHImageManager option, but it seems excessive to need to get permissions only for that.

Second question would be then, what can we do to load thumbnails without asking for permission?

I created a feedback report with a video and sample code to reproduce -> FB15493683

  1. NSItemProvider load methods return a NSProgress object which you can use to show the progress indicator.
  2. Please double check if you have set configuration.preferredAssetRepresentationMode = .current so you can skip the transcoding process (which can be slow).
  3. We will look into FB15493683. It would be great if you can attach a sysdiagnose that has logs for those extra long deferred processing operations.
  4. Currently, you will need to request library access for thumbnails. Feel free to submit a separate Feedback for getting thumbnails without library access. Thank you!

Thanks for the quick answer.

  1. Yes, we are aware of the progress indicator, we would like to show it on top of the thumbnail.
  2. Yes, we are using configuration.preferredAssetRepresentationMode = .current
  3. Ok, I just uploaded them
  4. I'll submit another one for the thumbnails.
PHPickerResult slow loading, plus no thumbnails
 
 
Q