Closed hkarmoush closed 2 years ago
@7snalbar also repeat same issue for resume downloading
@Harshad290194 Did you understand what caused it? Or do you have any more information on how to regenerate the issue? If yes then It'd help me solve it. Since @mzeeshanid doesn't care to reply on the issues that his work caused.
Thanks
@7snalbar When we pause download task and resume again then crash issue is generated.. not for every time but some time generate... issue is generated in latest pod file... not old pod file...
@7snalbar When we start downloading and kill app when already downloading inProgress.. and resume download then crash is generated... for resume data...
Try this:
fileprivate func isValidResumeData(_ resumeData: Data?) -> Bool {
guard resumeData != nil || resumeData?.count > 0 else {
return false
}
do {
var resumeDictionary : AnyObject!
resumeDictionary = try PropertyListSerialization.propertyList(from: resumeData!, options: PropertyListSerialization.MutabilityOptions(), format: nil) as AnyObject?
var localFilePath = (resumeDictionary?["NSURLSessionResumeInfoLocalPath"] as? String)
if localFilePath == nil || localFilePath?.count < 1 {
localFilePath = (NSTemporaryDirectory() as String) + (resumeDictionary["NSURLSessionResumeInfoTempFileName"] as! String)
}
let fileManager : FileManager! = FileManager.default
debugPrint("resume data file exists: \(fileManager.fileExists(atPath: localFilePath! as String))")
return fileManager.fileExists(atPath: localFilePath! as String)
} catch let error as NSError {
debugPrint("resume data is nil: \(error)")
return false
}
}
Although, when resuming the download after quitting the app, the download fails and causes new downloads to fail as well. Reply if you find a fix to this issue.
Hi All,
I'm also facing this issue. Anyone working on solutions?
Hello everyone! I'am also facing this issue. When I pause the task, relaunch the app and click the Downloading button. The crash occur. Anyone can help me? Thanks a lot!
In upcoming version i will remove this function as it is no longer needed.
Try this:
fileprivate func isValidResumeData(_ resumeData: Data?) -> Bool { guard resumeData != nil || resumeData?.count > 0 else { return false } do { var resumeDictionary : AnyObject! resumeDictionary = try PropertyListSerialization.propertyList(from: resumeData!, options: PropertyListSerialization.MutabilityOptions(), format: nil) as AnyObject? var localFilePath = (resumeDictionary?["NSURLSessionResumeInfoLocalPath"] as? String) if localFilePath == nil || localFilePath?.count < 1 { localFilePath = (NSTemporaryDirectory() as String) + (resumeDictionary["NSURLSessionResumeInfoTempFileName"] as! String) } let fileManager : FileManager! = FileManager.default debugPrint("resume data file exists: \(fileManager.fileExists(atPath: localFilePath! as String))") return fileManager.fileExists(atPath: localFilePath! as String) } catch let error as NSError { debugPrint("resume data is nil: \(error)") return false } }
Although, when resuming the download after quitting the app, the download fails and causes new downloads to fail as well. Reply if you find a fix to this issue.
Someone can let me know. Does it work?
We already solve this issue.. Thank you so much for your reply
On Mon, 19 Aug 2019 at 1:01 PM, Duc Nguyen notifications@github.com wrote:
Try this:
fileprivate func isValidResumeData(_ resumeData: Data?) -> Bool {
guard resumeData != nil || resumeData?.count > 0 else { return false } do { var resumeDictionary : AnyObject! resumeDictionary = try PropertyListSerialization.propertyList(from: resumeData!, options: PropertyListSerialization.MutabilityOptions(), format: nil) as AnyObject? var localFilePath = (resumeDictionary?["NSURLSessionResumeInfoLocalPath"] as? String) if localFilePath == nil || localFilePath?.count < 1 { localFilePath = (NSTemporaryDirectory() as String) + (resumeDictionary["NSURLSessionResumeInfoTempFileName"] as! String) } let fileManager : FileManager! = FileManager.default debugPrint("resume data file exists: \(fileManager.fileExists(atPath: localFilePath! as String))") return fileManager.fileExists(atPath: localFilePath! as String) } catch let error as NSError { debugPrint("resume data is nil: \(error)") return false } }
Although, when resuming the download after quitting the app, the download fails and causes new downloads to fail as well. Reply if you find a fix to this issue.
Someone can let me know. Does it work?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mzeeshanid/MZDownloadManager/issues/85?email_source=notifications&email_token=AEDZ4E4OAFPKCWNBJ4PG54LQFJD47A5CNFSM4G3ZPN62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4R66SY#issuecomment-522448715, or mute the thread https://github.com/notifications/unsubscribe-auth/AEDZ4E77QWOQRXVJVG2VX23QFJD47ANCNFSM4G3ZPN6Q .
@Harshad290194 Thank a lot.
The reason for the crash or the scenario that this crash is caused is not clear for now. I will be attaching the crash report from Firebase Crashlytics and let's hope someone faced the same issue and may provide either a scenario for this crash to be triggered so I can debug it and the have a solution for it.