in a project, I need to cancel an active download session. As the Session class does not provide any cancel method, I tried the following:
Modifying the Session class by a getOperationQueue() method, that gives me the operationQueue member variable
calling the .cancelAllOperations() method on this queue
The good thing: It cancels the download (in most of the cases - sometimes, the download does continue, which I see from the XCode stats section).
The bad thing: If I start a new session afterwards and call the download method, the completion block is never called, and the download does not work any more :-(
Any ideas? Is my approach to cancel all operations on the queue right or what would you recommend?
Hi,
in a project, I need to cancel an active download session. As the Session class does not provide any cancel method, I tried the following:
The good thing: It cancels the download (in most of the cases - sometimes, the download does continue, which I see from the XCode stats section).
The bad thing: If I start a new session afterwards and call the download method, the completion block is never called, and the download does not work any more :-(
Any ideas? Is my approach to cancel all operations on the queue right or what would you recommend?
Bye, Wolfgang