I am trying to save a video to Gallery and after that retrieving the asset, in ios 12 it worked fine, now testing it in ios 13 is not working anymore. The video is correctly saved, but the asset retrieved is not the correct one, instead, it is another from the library.
PHPhotoLibrary.shared().performChanges({
PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: filePath)
}) { completed, error in
if completed {
let fetchOptions = PHFetchOptions()
fetchOptions.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: true)]
let fetchResult = PHAsset.fetchAssets(with: .video, options: fetchOptions).lastObject
GeneralUtils().shareVideoFacebook(fetchResult!, self)
}
}