IOS asi--Managing multiple requests

Source: Internet
Author: User

ASIHTTPRequest inherits from Nsoperation so that multiple requests can be placed in one queue, making it easier to manage multiple requests

ASIHTTPRequest *request1 = [[ASIHTTPRequest alloc]init];

ASIHTTPRequest *request2 = [[ASIHTTPRequest alloc]init];

ASIHTTPRequest *request3 = [[ASIHTTPRequest alloc]init];

Nsoperationqueue *queen = [[Nsoperationqueue alloc]init];

[Queen Addoperation:request1]; // Benefit 1: Once the request is added to the queue, it will automatically start executing without the Startasynchronous method.

[Queen Addoperation:request2];

[Queen Addoperation:request3];

Benefit 2: Batch management can be achieved

[Queen Setsuspended:yes]; //Pause at the same time

[Queen Setmaxconcurrentoperationcount:1]; //Set maximum concurrency, concurrency is 1, meaning request1 execution is done, automatic execution of Request2

[Queen Cancelalloperations]; //Cancel at the same time

// Benefit 3: Add dependency

[Request2 Adddependency:request1]; Request1 execution is done before Request2 is executed.

[Request3 Adddependency:request2]; Request2 execution is done before Request3 is executed.

IOS asi--Managing multiple requests

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.