0

When we fill value string section in Info.plist for "Privacy - Photo Library Additions Usage Description" and as the application try to copy video file to Photo Library iOS automatically ask authorization and everything goes ok after that.

But in that case it is not enough. We would like to do things if user do not want it.

We are doing it for camera usage as following;

func checkCameraAuthorizations(){

    // Checks privacy authorizations and change aplication behaviour accordingly.

    if AVCaptureDevice.authorizationStatus(for: .video) ==  .authorized {

        cameraUsageAuthorized = true

    } else {

        AVCaptureDevice.requestAccess(for: .video, completionHandler: { (granted: Bool) in
            if granted {

                self.cameraUsageAuthorized = true


            } else {
                self.cameraUsageAuthorized = false
            }
        })
    }      
}

We are using cameraUsageAuthorized variable in several place in application about camera usage.

But we could not find a similar function for video file copy from application document directory to Photo Library.

Also, we are filling Privacy values by hand in Info.List. Is there anyway to do it programmatically?

Hope
  • 2,096
  • 3
  • 23
  • 40

1 Answers1

0

I could not find write only permission but as much as I see following code takes both write and read permission to photo library.

   if  PHPhotoLibrary.authorizationStatus() == .authorized {

         self.photoLibraryAuthorized = true

    } else {

        PHPhotoLibrary.requestAuthorization { status in

            if status == .authorized {

                self.photoLibraryAuthorized = true

            } else {

                self.photoLibraryAuthorized = false

            } 
        }
    }

But you must fill Privacy - Photo Library Additions Usage Description and Privacy - Photo Library Usage Description values.

I still don't know how to fill permission value strings in Info.plist programmatically though.

Hope
  • 2,096
  • 3
  • 23
  • 40