I had a strange problem with moving the file .movcreated by my application from the document folder to the camera roll. A bit of background:
The app makes movies in slow motion. It works specifically with devices that have a 12 megapixel 4032x3024 sensor. He created movies in the application's document folder. Movies can be saved both 4k and HD. They can also be saved as a movie with a 4: 3 aspect ratio of the entire sensor or a 16: 9 crop sensor. If the user wants the movie to be saved in the Camera Roll of the device, they can set this parameter. My problem occurs when I try to move a full-size movie (4032x3024) from the applicationโs document folder in Camera Roll . I get this error:
Domain Error = NSCocoaErrorDomain Code = -1 "(null)"
The film is in order, it is still sitting in the document folder. It simply cannot be copied to Camera Roll. If I do the same operation using the same code with any other size, no problem. 4: 3 HD (1440x1080) works fine, 16: 9 HD (1920x1080) works fine, 16: 9 4k (3880x2160) works fine. It is just 4: 3 4k (4032x3024) that generates this error when I try to move it.
This is the code that performs the move:
PHPhotoLibrary.shared().performChanges({
PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: cameraRollURL!)
The url is OK because it works fine with other sizes.
source
share