iosnsurlsessionnsurlsessiontask

Does NSURLSessionTask keep taskIdentifier after session reconnection?


I kick off several NSURLSessionUploadTasks in a background NSURLSession. I want to know for sure whether all tasks keep their original taskIdentifier after I reconnect to this session in -application:handleEventsForBackgroundURLSession:completionHandler:, because I need to know which task is for which request and taskIdentifier is the only information I can use. I can not use URL to differentiate these POST requests because they are targeted to the same URL.


Solution

  • From the results of my own experiments, I can confirm that NSURLSessionTask keeps taskIdentifier after session reconnection.