I am facing weird issue while try to download file using URLSession
and URLSessionConfiguration.background(withIdentifier: Bundle.main.bundleIdentifier!)
While start downloading file using URLSession.downloadTask
with background configuration.
Downloading not working properly in iOS iOS 12.* versions and working properly on newer versions.
In iOS 12.* versions I found weird issue that after fresh installation from Xcode or AppStore downloading file gives error below.
2021-02-16 10:25:44.448330+0530 Brain Wellness App[512:141574] Task <546389FE-6503-4F43-A01C-C174A09C2892>.<45> load failed with error Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={NSErrorFailingURLStringKey=***, NSErrorFailingURLKey=***, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"BackgroundDownloadTask <546389FE-6503-4F43-A01C-C174A09C2892>.<45>",
"LocalDownloadTask <546389FE-6503-4F43-A01C-C174A09C2892>.<45>"
), _NSURLErrorFailingURLSessionTaskErrorKey=BackgroundDownloadTask <546389FE-6503-4F43-A01C-C174A09C2892>.<45>} [2]
Error is Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={NSErrorFailingURLStringKey=***, NSErrorFailingURLKey=***, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"BackgroundDownloadTask <546389FE-6503-4F43-A01C-C174A09C2892>.<45>",
"LocalDownloadTask <546389FE-6503-4F43-A01C-C174A09C2892>.<45>"
), _NSURLErrorFailingURLSessionTaskErrorKey=BackgroundDownloadTask <546389FE-6503-4F43-A01C-C174A09C2892>.<45>}
But after closing and relaunching app from Home screen file downloading works normally as it should be.
Also background download functionality was working normally around 1 month ago in iOS 12.* versions. I am getting above error in iOS 12.* versions from few days only earlier it was working fine.
Is anyone face this issue earlier and found solutions for this issue ?
If yes then please help me solve this issue.