iOS11 photo library access is possible even if settings are set to “never”

后端 未结 4 1905
悲哀的现实
悲哀的现实 2020-12-01 03:20
if UIImagePickerController.isSourceTypeAvailable(.photoLibrary) {
    let imagePicker = UIImagePickerController()
    imagePicker.sourceType = .photoLibrary
    imag         


        
4条回答
  •  渐次进展
    2020-12-01 04:07

    Is this expected behaviour? - YES.

    From the docs - https://developer.apple.com/documentation/uikit/uiimagepickercontroller/1619144-issourcetypeavailable

    true if the device supports the specified source type; false if the specified source type is not available.

    It tells you if the device supports the source type and not if the app has the permission to access it.

    As you already mentioned in the question, PHPhotoLibrary.authorizationStatus() would be correct way to check this.

提交回复
热议问题