IOS recommends a third-party library for download

Source: Internet
Author: User

Afnetworking has the download function, but the download function is relatively basic, in order to implement the complex download function needs to write some code. Today, I found a downloadable open source project on GitHub, which is very good and links to the following: Https://github.com/thibaultCha/TCBlobDownload.

Whether it's afnetworking or the library I mentioned, I used nsoperation, and I took advantage of a key function Nsurlconnection Scheduleinrunloop, which is explained as follows

delegate.

When connection is added to the queue running operation, the thread that runs operation does not end immediately after the request is made, but waits for the callback function to be called, which is the requirement to send and accept network data in an asynchronous thread. If using the Operation function at the same time, only using the normal connection Start method, then only the link request is sent asynchronously, and his callback method will still be executed in the main thread, And it is not possible to limit the number of requests by limiting the number of concurrent operationqueue, because that will only guarantee the concurrent number of simultaneous requests, when the request is made, without waiting for a callback, the thread ends and a new request is made, so that often all requests are sent out quickly, not satisfying the requirements.

IOS recommends a third-party library for download

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.