I'm facing issues on 16.0 using PHPickerViewController
with PHPickerConfiguration
config.selection = .people
. The PHPicker screen shows an error "Unable to Load Photos". Xcode 14.0.1.
import UIKit
import PhotosUI
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
showPicker()
}
private func showPicker() {
var config = PHPickerConfiguration(photoLibrary: .shared())
config.filter = .images
config.selection = .people
config.selectionLimit = 10
let vc = PHPickerViewController(configuration: config)
vc.delegate = self
self.present(vc, animated: true, completion: nil)
}
}
extension ViewController: PHPickerViewControllerDelegate {
func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
}
}
Console log:
[Picker] Showing picker unavailable UI (reason: crashed) with error: (null) viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
If I comment that line (config.selection = .people
) it works perfect.
My question is: Has anyone gone through this? know how to fix it?