Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Owner and Founder. Opencart
Top Partners
In most of the time user switch between one page to another or one controller to another using tab bar icon without waiting for its result. due to this reason multiple network request ongoing and application becomes slow, it’s better to dismiss all its previous network request and keep only current network request so we can get the data fast. here I have taken the example of URLSession request:
1: Define the global class where we have to make a network request and with the help of delegate method, we can get the data to the respective class.
2: Lets we have a global class like:
Note:
a: here task is a global variable.
b: if let error = error as NSError?, error.domain == NSURLErrorDomain && error.code == NSURLErrorCancelled { }
This one detects when we cancel the previous task.
If this will execute we will nothing to do otherwise we are maintaining the server error response.
3: in every view controller we are doing this:
4: define this method in the global class where we have written the network request.
5: Now this will cancel the previous request and load the current request.
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
It was a successful collaboration. The Mobikul team provided the client everything they needed in a timely and high-quality manner. They were very professional, reliable, and accessible during the entire process. The client also saw no room for any improvements in the vendor's performance.
Vincenzo Carrano
Administrator, Segshop
USA
India
Global
Name
Email
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.