Network Programming for iOS development-1. Basic use of NSURLSession and iosnsurlsession

Source: Internet
Author: User

Network Programming for iOS development-1. Basic use of NSURLSession and iosnsurlsession

Before learning how to use NSURLSession, I should first learn a good article about NSURLSession, From NSURLConnection to NSURLSession, or a Chinese translation From NSURLConnection to NSURLSession. alternatively, you can directly learn "from NSURLConnection to NSURLSession" without learning your blog garden notes. This article gives a detailed description of the use of NSURLSession. However, this article first gives a rough introduction to the basic NSURLSession and basic network request usage for my forgotten review ????.

 

Learn about NSURLSessionTask:

NSURLSessionTask is required to use NSURLSession. Therefore, we need to know the relationship between the class of the Task and its subclass:

    

English decoding ?? : Session Task

New Code knowledge:

NSURLSession:

-(NSURLSessionDataTask *) dataTaskWithRequest creates a task based on the request object

-(NSURLSessionDataTask *) dataTaskWithURL creates a task based on the requested URL

 

NSURLSessionDataTask:

-(Void) resume starts to execute the task

  

Basic code Display (using NSURLSessionDataTask ):

Code display using the proxy method:

 

Reprinted with address: http://www.chengxuyuans.com/iPhone_IOS/97837.html

Q: one-click call to programmer Q & A artifacts, one-to-one service, developer programming required official website: www.wenaaa.com

QQ Group 290551701 has gathered many Internet elites, Technical Directors, architects, and project managers! Open-source technology research, welcome to the industry, Daniel and beginners interested in IT industry personnel!

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.