Error Domain=NSCocoaErrorDomain Code=-1 “(null)” when moving .mov to camera roll

匿名 (未验证) 提交于 2019-12-03 00:51:01

问题:

I'm having a weird problem moving a .mov file created by my app from the documents folder to the camera roll. A bit of background:

The app makes time lapse movies. It works specifically with the devices that have a 12 megapixel 4032x3024 sensor. It created the movies in the app's documents folder. The movies can be saved as either 4k or HD. They can also be saved as a 4:3 aspect ratio movie of the entire sensor, or a 16:9 crop of the sensor. If the user wants the movie to be stored in the Camera Roll of the device, they can set that option. My problem exists when trying to move a full size movie (4032x3024) from the app's documents folder to the Camera Roll. I get this error:

Error Domain=NSCocoaErrorDomain Code=-1 "(null)"

The movie is fine, it's still sitting in the document's folder. It just can't be copied to the Camera Roll. If I do this same operation through the same code with any of the other sizes, no problem. A 4:3 HD (1440x1080) works fine, a 16:9 HD (1920x1080) works fine, a 16:9 4k (3880x2160) works fine. It's just the 4:3 4k (4032x3024) that generates this error when I try to move it.

This is the code that does the move:

PHPhotoLibrary.shared().performChanges({             PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: cameraRollURL!) 

The URL is OK because it works with the other sizes just fine.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!