IOS Study Notes 4-iOS development asynchronous download

Source: Internet
Author: User

Launch:

 

 

 

 

Callback method time:

 

 


1. After receiving the HTTP header, it is called when the data is actually claimed. Generally, some data storage objects such as NSMutableData are initialized in this method;

-(Void) connection :( NSURLConnection *) connection didReceiveResponse :( NSURLResponse *) response

2. This function is called every time a piece of data is received. Generally, data is added to the NSMutableData object.

-(Void) connection :( NSURLConnection *) connection didReceiveData :( NSData *) data

3. Call when receiving data fails and the download is interrupted

-(Void) connection :( NSURLConnection *) connection didFailWithError :( NSError *) error

4. Finally, if the connection is successful and downloaded, it will be called. Generally, some memory created by alloc will be released here.

-(Void) connectionDidFinishLoading :( NSURLConnection *) connection;


Progress tracking:
Each ASIHTTPRequest has two delegate entries to track the progress:
1: downLoadProgressDelegate (download) Example: [request setDownloadProgressDelegate: cell];

2: upLoadProgressDelgate (upload)


 

If you execute a single request, you need to set the upload/download progress for the request.
If you are making multiple requests and want to track the progress of the entire queue, you must use ASINetworkQueue and set the queue progress to delegate.

 

 

Related Article

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.