3

I am trying to save a video in my photo library. But sometimes I get an error: The operation couldn’t be completed. (PHPhotosErrorDomain error -1.)

This is my code:

PHPhotoLibrary.shared().performChanges({
            PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: exporter!.outputURL!)
               }) { saved, error in
                   if saved {
                       print("video saved to camera roll")
                   } else {
                    print(error?.localizedDescription)
                }
               }
adri567
  • 533
  • 5
  • 20

1 Answers1

-1

I was able to resolve this by removing the AVVideoQualityKey within AVVideoCompressionPropertiesKey in my video output settings for AVAssetWriter.

Melly
  • 675
  • 5
  • 6