PHPhotoLibrary.shared().performChanges({
PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: videoURL as URL)
}) { success, error in
if !success {
print("Error saving video: \(String(describing: error))")
}
}
Results in: Error saving video: Optional(Error Domain=PHPhotosErrorDomain Code=-1 "(null)")
I found this similar problem solution on github for images and I think objC(?):
the code below will cause error on iOS 13 devices when import uri is https://xxxxx.png assetRequest = [PHAssetChangeRequest creationRequestForAssetFromImageAtFileURL:inputURI];
this way works well NSData *data = [NSData dataWithContentsOfURL:inputURI]; UIImage *image = [UIImage imageWithData:data]; assetRequest = [PHAssetChangeRequest creationRequestForAssetFromImage:image];
https://github.com/react-native-community/react-native-cameraroll/issues/159
So I am thinking I might need to find a wrapper class for video? I'm finding if very difficult to find good resources for working with swift.