iOS 17, NSURLSession, NSURLSessionDownloadTask, 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
// 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];

Looking forward to your reply!!!

I have the same problem.

I would like to inquire if there have been any changes to NSURLSession in this version?

Major OS releases tend to have changes in every subsystem, but I’m not aware of a specific change that would cause this.

Recently, on the iOS 17.0 system version, I've noticed an increase in ENOENT errors.

That wording suggests that you’re seeing intermittent errors. Is that right? Are you able to reproduce this in your office?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Even, We could see the same issue. The weird thing is that changing NSURLSession configuration to defaultSessionConfiguration to BackgroudSessionConfiguration worked for us.. Hope it works for you. Please give it a try and see.

I also have the same problem and it is difficult to recover. After it occurs, just restart the app and it will be fine. Mine is not background session, what is the cause?

hi~have you found a solution to this problem?

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

iOS 17, NSURLSession, NSURLSessionDownloadTask, Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"
 
 
Q