Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"

Hello, My App uses NSURLSession to send network requests. Recently, on the iOS 17.0 system version, I've noticed an increase in ENOENT errors. However, I'm unable to identify the cause from the logs. I would like to inquire if there have been any changes to NSURLSession in this version? Why would this error code occur?

Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={NSErrorFailingURLStringKey=https://example.com, NSErrorFailingURLKey=https://example.com, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDownloadTask <AC10B665-F59A-469C-876C-F88EEAEC26E1>.<11>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDownloadTask <AC10B665-F59A-469C-876C-F88EEAEC26E1>.<11>}, response:<NSHTTPURLResponse: 0x280b8d000> { URL: https://example.com } { Status Code: 200

To add on, according to the online logs, I found that the error occurs when users put the App into the background for a minute, then hot restart the App and bring it to the foreground to initiate a network request.

Looking forward to your reply

// session
NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
NSOperationQueue *operationQueue = [[NSOperationQueue alloc] init];
operationQueue.maxConcurrentOperationCount = 1;
_session = [NSURLSession sessionWithConfiguration:config delegate:self delegateQueue:operationQueue];

// task
NSURLSessionTask *task = [self.session downloadTaskWithRequest:operation.request];
task.priority = operation.networkPriority;
[task resume];

Hi, I also encountered the same error recently. How did you solve it?

Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"
 
 
Q