in my app, send request with NSURLSession. but i can not get available infomation ( eg. remoteAddress, TLS version) when request failed
i want get more infomation for failed request. eg. remoteAddress, remotePort, TLS Version...
in my app, send request with NSURLSession. but i can not get available infomation ( eg. remoteAddress, TLS version) when request failed
If a request is cancelled you should still get some NSURLSessionTaskTransactionMetrics
on the cancelled task. It may not be complete but some of the data should be there.
Regarding:
i want get more infomation for failed request. eg. remoteAddress, remotePort, TLS Version...
If a task fails because of an unknown reason, like a bad hostname that I just tested, you will get very little data in the metric report because nothing happened on the request to give you the information that you are looking for. For example, you are looking for remoteAddress, remotePort, and TLS version, but in my failure example for a bad hostname you won't get this data because the connection failed to even setup to send the request so none of that data is available. So it depends on where in the connection / request lifecycle your failure occurs as to what data you get, otherwise, you are correct, if it fails at the beginning, nothing will be there.