Privacy - Photo Library Usage Description" not working in iOS 13

I am having problems with NSPhotoLibraryAddUsageDescription.

In my info.plist I did select Privacy - Photo Library Usage Description" but it did not ask the permission to save the image and app crashed.

Does anyone else have the same issue?

Replies

There are 2 authorizations:

- NSPhotoLibraryAddUsageDescription

and

- NSPhotoLibraryUsageDescription


The first if you only write photos

The second if read and write.


Have you entered a String in the plist.


Did you test for authorization ?


Some code like (I put it early in viewDidLoad:


        var accessGranted = false 
               //  First test if camera access is authorized
        switch AVCaptureDevice.authorizationStatus(for: .video) {
        case .authorized: // The user has previously granted access to the camera.
            accessGranted = true
           
        case .notDetermined: // The user has not yet been asked for camera access.
            AVCaptureDevice.requestAccess(for: .video) { granted in
                if granted {
                    accessGranted = true
                }
            }
           
        case .denied: // The user has previously denied access.
            return

        case .restricted: // The user can't grant access due to restrictions.
            return;
        @unknown default:
            return
        }
       
        if !accessGranted { return }    // Or whatever you need to do