if UIImagePickerController.isSourceTypeAvailable(.photoLibrary) {
let imagePicker = UIImagePickerController()
imagePicker.sourceType = .photoLibrary
imag
UIImagePickerController and PHPhotoLibrary responsible for different areas.
You should check both: auth status and source availability.
PHAuthorizationStatus
Information about your app’s authorization to access the user’s Photos library.
isSourceTypeAvailable
Discussion
Because a media source may not be present or may be unavailable, devices may not always support all source types.
For example, if you attempt to pick an image from the user’s library and the library is empty, this method returns false. Similarly, if the camera is already in use, this method returns false.