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!