Check Mobile App
Read now
Start a Project

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

When I think in getting solutions for my Ecommerce Platform, I think of Webkul. They have been such a blessing in our business. We have spent thousands of dollars in support and modules from them. We love their support team. They work very closely with us, and they always go the extra mile when we need help.

Michael Urresta

Michael Urresta

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