Fawkes Fawkes - 1 year ago 276
iOS Question

iOS Alamofire stop all requests

Is there any way I can for example say:


Of course it would be great if these requests especially in case of image download would only be paused for later when I'll cal the same URL but... I need at least to be able to cancel all requests at a global level. Some suggestions ?

In my app I have a wrapper above the Alamofire.request(.Post....) way of doing things so I would really appreciate not making me create or interact with Manager class in another way besides that specified above.

Answer Source

You should use the NSURLSession methods directly to accomplish this.


This will call all your completion handlers with cancellation errors. If you need to be able to resume downloads, then you'll need to grab the resumeData from the request if it is available. Then use the resume data to resume the request in place when you're ready.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download