App is able to get photos without providing access to the photos. As a demo I created simple application with one VC, one button and one image view in it. And I was able to pick any image in photo gallery and present in the imageView.
iOS 16.0 reproduces on any iPhones
Here is a simple code example:
import UIKit
import Photos
import PhotosUI
class ViewController: UIViewController, PHPickerViewControllerDelegate, UINavigationControllerDelegate {
@IBOutlet weak var selectedPhoto: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func selectPhoto(_ sender: Any) {
var configuration = PHPickerConfiguration()
configuration.selectionLimit = 1
configuration.filter = .images
let picker = PHPickerViewController(configuration: configuration)
picker.delegate = self
self.present(picker, animated: true)
}
func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
for result in results {
result.itemProvider.loadObject(ofClass: UIImage.self, completionHandler: { [weak self] image, error in
if let image = image as? UIImage {
DispatchQueue.main.async {
self?.selectedPhoto.image = image
picker.dismiss(animated: true)
}
}
})
}
}
}