Hi, I am cancelling a request but after .cancel() callback is called without errors and with a valid response. I call the cancel on the viewDidDisappear method because users can leave the screen while continue loading.
This can certainly happen. The NSURLSession
APIs are all asynchronous in nature. Calling cancel
does not ensure the request is actually cancelled before it is able to complete.
Cheers. 馃嵒
But it should prevent calling the callback... Which is the workaround? I don't want to block the screen during the request. If users want to go back, they should be able to do that action.
Same problem with response.response = nil and cannot differentiate is this nil from cancel or timeout. Request did not finish and cancel still calls callback.
Most helpful comment
Same problem with response.response = nil and cannot differentiate is this nil from cancel or timeout. Request did not finish and cancel still calls callback.