when I'm trying to save the Video that is longer than 30 min, i got this massage after the video complete downloaded "Error Domain=NSCocoaErrorDomain Code=-1 "(null)" my app is about 3 gb right know but nothing saved in my photo library.
func downloadVideo()
{
let destination: DownloadRequest.DownloadFileDestination = { _, _ in
var documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first as URL!
let pathComponent = "\(String(describing: documentsURL))/tempFile.mp4"
documentsURL?.appendPathComponent(pathComponent)
return (documentsURL!, [.createIntermediateDirectories, .removePreviousFile])
}
Alamofire.download(self.downloadUrl, to: destination).responseData { response in
if response.destinationURL == nil{
self.alertMessage2(titleText: "Error", messageText: "No Video URL", style: .actionSheet, actionTitle: "OK", actionStyle: .default , handler: {(action) in self.performSegue(withIdentifier: self.home, sender: self)})
print("no url ")
//
}else{
print("succes ")
PHPhotoLibrary.shared().performChanges({
PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: response.destinationURL!)
}) { saved, error in
if saved { self.alertMessage2(titleText: "Your video was successfully saved", messageText: "", style: .alert, actionTitle: "OK", actionStyle: .default , handler: {(action) in self.performSegue(withIdentifier: self.home , sender: self)})
}else {print("fel", error!)}}
}
}
.downloadProgress { progress in
self.progressView.progress = Float(progress.fractionCompleted)
print("Progress: \(progress.fractionCompleted)")
}
}