我正在尝试将视频保存到我的照片库中。但有时我会得到一个错误:操作无法完成。 (PHPhotosErrorDomain 错误 -1。)
这是我的代码:
PHPhotoLibrary.shared().performChanges({
PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: exporter!.outputURL!)
}) { saved, error in
if saved {
print("video saved to camera roll")
} else {
print(error?.localizedDescription)
}
}
最佳答案
我能够通过在 AVAssetWriter 的视频输出设置中删除 AVVideoCompressionPropertiesKey 中的 AVVideoQualityKey 来解决这个问题。
关于swift - PHPhotoLibrary 出错,无法保存视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60250295/