Post

Replies

Boosts

Views

Activity

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: Take a photo in normal photo mode with Apple's native camera app (not in portrait mode). Launch the PHPickerDemo app. Tap the photo icon located in the top right. 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.
2
1
1k
Oct ’23