adri567
adri567

Reputation: 661

Error on PHPhotoLibrary, cannot save video

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)
                }
               }

Upvotes: 4

Views: 1114

Answers (1)

Melly
Melly

Reputation: 675

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

Upvotes: -1

Related Questions