PHPickerViewController: Cannot Load Photos Taken Within 30 Seconds Using iOS 17.0.3 Camera App

In iOS 17.0.3, photos taken using Apple's native camera app can't be loaded immediately (within approximately 30 seconds) through PHPickerViewController. Specifically, the method itemProvider.canLoadObject(ofClass: UIImage.self) returns false. However, after about 30 seconds post-capture, the photos load without any hindrance.

Initially, I considered an issue with my own photo-loading code, but the same problem persists even with Apple's official PHPickerDemo sample code.

[PHPickerDemo - SelectingPhotosAndVideosInIOS.zip] https://developer.apple.com/documentation/photokit/selecting_photos_and_videos_in_ios

ViewController.swift Line 89 (PHPickerDemo)

func displayNext() {
    guard let assetIdentifier = selectedAssetIdentifierIterator?.next() else { return }
    currentAssetIdentifier = assetIdentifier

    let progress: Progress?
    let itemProvider = selection[assetIdentifier]!.itemProvider
    if itemProvider.canLoadObject(ofClass: PHLivePhoto.self) {
        progress = itemProvider.loadObject(ofClass: PHLivePhoto.self) { [weak self] livePhoto, error in
            DispatchQueue.main.async {
                self?.handleCompletion(assetIdentifier: assetIdentifier, object: livePhoto, error: error)
            }
        }
    }
    else if itemProvider.canLoadObject(ofClass: UIImage.self) {      <========================================= FALSE
        progress = itemProvider.loadObject(ofClass: UIImage.self) { [weak self] image, error in
            DispatchQueue.main.async {
                self?.handleCompletion(assetIdentifier: assetIdentifier, object: image, error: error)
            }
        }
    }
    ...omitted...
}

Environment & Settings:

  • iPhone 12
  • iOS 17.0.3
  • Settings -> Camera -> Formats -> High Efficiency (Enabled)

Reproduction Steps:

  1. Take a photo in normal photo mode with Apple's native camera app (not in portrait mode).
  2. Launch the PHPickerDemo app.
  3. Tap the photo icon located in the top right.
  4. Observe that the photo fails to load.

Workarounds:

  • Wait for over 30 seconds prior to selecting the photo.
  • Opt to shoot in portrait mode rather than the standard photo mode.
  • Switch on Settings -> Camera -> Formats -> Most Compatible.

I am developing a photo editing app, and I have received many emails from users stating that they cannot select photos since updating to iOS 17.

Thanks.

Could you please submit a Feedback using the Feedback app? Thanks!

To workaround this issue, you can set configuration.preferredAssetRepresentationMode to .current, use itemProvider.loadDataRepresentation with UTType.image and create a UIImage object using the Data you received.

I am encountering the same problem with the same configuration. iPhone 15 pro, iOS 17.0.3

PHPickerViewController: Cannot Load Photos Taken Within 30 Seconds Using iOS 17.0.3 Camera App
 
 
Q