Ios--nsurlsessiontask

Source: Internet
Author: User

This chapter mainly introduces some basic properties and proxies of abstract class Nsurlsessiontask

First, Nsurlsessiontask

1. Nsurlsessiontask is the base class for all request tasks and is an abstract class, so it is not possible to create a specific network request task

2. The unique identifier assigned to each task by the system

@property (readonly

3. Request object that the current task is accessing

readonly, copy) nsurlrequest  *currentrequest;

4. Request object for the last access of the current task

readonly, copy) nsurlrequest  *originalrequest;

5. Response header information for the current task

readonly, copy) Nsurlresponse *response;               

6. The data size (in bytes) that the current task has accepted

@property (readonly) int64_t countofbytesreceived;

7. Total data size to be accepted by the current task

@property (readonly) int64_t countofbytesexpectedtoreceive;

8. Size of data already sent by the current task

@property (readonly) int64_t countofbytessent;

9. Total size of data to be sent by the current task

@property (readonly) int64_t countofbytesexpectedtosend;

10. Set the description information for a task

@property (nullable, copy) NSString *taskdescription;

11. Error message if a task request fails

readonly, copy) Nserror *error;

12. Request status of the current task

@property (readonly) nsurlsessiontaskstate state;

Nsurlsessiontaskstate is an enumeration, as follows

1 typedef ns_enum (Nsinteger, nsurlsessiontaskstate) {2Nsurlsessiontaskstaterunning =0,//The current task is accepting data3nsurlsessiontaskstatesuspended =1,//The current task is paused4Nsurlsessiontaskstatecanceling =2,//the current task is canceled and Nsurlsessiontaskdelegate's task:didcompletewitherror is called: Message5nsurlsessiontaskstatecompleted =3,//The current task is complete6} ns_enum_available (Nsurlsession_available, 7_0);

13. Start task, all tasks are called after creation to start the request

-(void) resume;

14. Pausing a task invokes Nsurlsessiontaskdelegate's Task:didcompletewitherror: Method

-(void) cancel;

15. Pausing a task

-(void) suspend;

Ios--nsurlsessiontask

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.