iOS 14 still display entire photo library despite of .limited status

Viewed 2429
let accessLevel : PHAccessLevel = .readWrite
  let phStatus = PHPhotoLibrary.authorizationStatus(for: accessLevel)
  if (phStatus == .notDetermined) {
    PHPhotoLibrary.requestAuthorization(for: accessLevel) {
      newStatus in
        if (newStatus == .limited) {
        var conf = PHPickerConfiguration()
        conf.selectionLimit = 1
        conf.filter = .any(of: [.images, .livePhotos])
        let picker = PHPickerViewController(configuration: conf)
        picker.delegate = self
        self.present(picker, animated: true)
      }
    }
  }

I use the code above to test iOS 14 new feature Limited Photos Library. In the code I use new Api authorizationStatus and requestAuthorization, and successfully get .limited status. But despite of .limited status, iOS 14 still display all photo of the library. Can anyone help me to solve this?

1 Answers

The .limited status does not affect the PHPickerViewController. In fact, even a .denied status does not affect the PHPickerViewController!

The picker is out-of-process and does not involve user authorization. The way you are configuring and presenting the picker, you are asking for images, not for direct access to the photo library; and you receive only the image that the user personally chooses.

So prior user authorization is not needed and is completely irrelevant. All of your code before var conf = PHPickerConfiguration() can be deleted.

Related