aqsa arshad
aqsa arshad

Reputation: 831

PHPhotoLibraryPreventAutomaticLimitedAccessAlert still shows select photos option while presenting photo library

As per the quick read the purpose of this key "PHPhotoLibraryPreventAutomaticLimitedAccessAlert" is to prevent limited library access. I have added this option in info.plist but it still shows "Select photos" option in permissions dialogue.

enter image description here

The code of getting permissions is following.

func checkPhotoLibraryPermission(completionBlock completion: @escaping ()->Void) {
        let status = PHPhotoLibrary.authorizationStatus()
        switch status {
        case .authorized:
            completion()
            break
        case .notDetermined,.denied,.restricted:
            // ask for permissions
            PHPhotoLibrary.requestAuthorization { (status) in
                switch status {
                case .authorized:
                    completion()
                    break
                case .notDetermined,.denied,.restricted:
                    self.alertToEncouragePhotoLibraryAccessWhenApplicationStarts()
                    break
                case .limited:
                    break
                }
            }
            break
        case .limited:
            break
        }
    }

Anyone please mention what is the exact purpose of this key and is it possible to even force drop this option ?

Upvotes: 1

Views: 1892

Answers (1)

matt
matt

Reputation: 535890

As far as i know the purpose of this key "PHPhotoLibraryPreventAutomaticLimitedAccessAlert" is to prevent limited library access.

That's incorrect. You cannot prevent use of limited authorization. It is built into the system and the user can always specify it.

So what is this key for? Well, if the user does specify limited access, the system may put up the Select Photos interface again from time to time to see whether the user wants to change what photos your app can access. PHPhotoLibraryPreventAutomaticLimitedAccessAlert prevents that. It does not prevent the user from specifying limited access in the initial authorization request alert or the Settings app.

Upvotes: 5

Related Questions