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

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


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

    This (new) behaviour does sound logical to me, here's why. When using UIImagePickerController your app doesn't actually get access to any photos. It only sees the one your user has picked, when that happens; and if the user taps Cancel in the picker none of those become available to the app.

    PHPhotoLibrary is part of a separate framework, Photos, where you can do a lot of stuff with the user's photo library, and therefore need permission.

    So if you are only using UIImagePickerController I'd suggest not mixing Photos stuff in.

    Disclaimer: haven't heard of any official statement from Apple folks. This forum thread looks relevant, maybe we get a reply there. UPD: there it is, same idea.

    Also, if you're evil enough you can theoretically fiddle with UIImagePickerController view hierarchy at runtime and examine whatever the user sees there. But that's again for Apple to deal with, we should just be nice :-)

提交回复
热议问题