How to Stop the Current Http Request in Alamofire using Swift 3

Save

stop HTTP request

In the normal application which is totally based on the Internet means not the offline mode, this types of an application always connect to the internet and make a Http or Https request on every click on the event in an application.

Some times user don’t want to stay in one controller on clicking the Http request and move to another controller due to that reason two HTTP request going on and response becomes slow so we need to discard the previous network request.

For this, we need to do some

1: Make a queue of the network request.

2: Discard the previous request.

For this, we need to do this

write this code in every  UIViewController

3: You can check whether it is working or not for this:

Note: error.localizeddescription ¬†will return “cancelled

Now you this in every controller for discard the previous request.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

css.php

We've bought a Shopware Extension which is a hybrid App, which we can now offer in the Google Play Store and the IOS App Store. I'am still impressed how fast and how sharp the support team leads us through every process of the App-Store clarification. Very fast and useful response.

Markus Walter

Markus Walter

Founder, Das Apartment Living

Talk to Sales

Global

Live Chat
Start a Project


    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home