0

I have an App which needs to Access Photos and Videos from the iPhone Photos App. in iOS 14+ Apple has Introduced new API PHPicker but that still lacks lot of common feature like Cropping image, trimming video.

Issue comes, When you have limited Access instead of Access to all photos, How to handle this?

let authorizationStatus = PHPhotoLibrary.authorizationStatus(for: .readWrite)
            switch authorizationStatus {
            case .limited:
                print("limited authorization granted")
                // ?????? -> Display UIImagePicker doesn't behave properly
            case .authorized:
                print("authorization granted")
                self.accessLibrary()
            case .notDetermined:
                print("Status not determined")
                PHPhotoLibrary.requestAuthorization(for: .readWrite) { status in
                    self.checkPhotoAccess()
                }
            default:
                print("Implement this")
                break
            }

Do we need to create an intermediate screen fetch all the PHAsset and let user select among those first (Photos for which access is given)?

OR there's another way?

Please suggest

Jatin Garg
  • 306
  • 1
  • 2
  • 16
  • What do you want to do in the case of limited access - show the picker so the user can select the photos they want ? Note that the limited access remembers the photos chosen before and you will only be able to work with the photos selected by the user in your app. Ofcourse, the user can update this selection to allow more media to be accessed by your app. – Shawn Frank Feb 10 '22 at 05:42
  • How to fetch the selected images or videos and also to show these do I need to create a custom UI now? – Jatin Garg Feb 10 '22 at 06:57
  • Fetching selected media is done the same way as fetching full access media, the Photos library will handle sending you back the right PHAssets. The two things to keep in mind with limited access is that the Photos library automatically presents the user a selection UI to select the media they want to import your app. Secondly, you might want to observe if the user has set limited access and you get 0 PHAssets, it means the user did not select media or the selected media was deleted. In that case, you manually need to show the modal with a button perhaps so the user cans select media to import. – Shawn Frank Feb 10 '22 at 07:15
  • Sorry, if I am missing something, Can you just link me somewhere how to show that asset screen, When I have the limited access one option is to present limited ImagePicker that allows user to select more media, but where do I get the already selected media, which part or the function of UIImagePicker leads me to that UI where selected media shows up – Jatin Garg Feb 10 '22 at 08:24
  • Here you go: https://developer.apple.com/documentation/photokit/delivering_an_enhanced_privacy_experience_in_your_photos_app – Shawn Frank Feb 10 '22 at 08:41

0 Answers0