For a long time did not go further, recently learned afnetworking framework, after the completion of the study to make a summary 1. Framework of third-party networks
Afnetworking is simple to use, the latest iOS features are well supported, the Nsurl is encapsulated, the system is a more complex method, the whole became a relatively simple
ASIHTTPRequest (has stopped updating) This framework encapsulates the Cfnetworking network framework with high performance and scalability, but has stopped updating, and the compatibility with the latest iOS is not very high, so very little
Mknetworkkit is relatively lightweight compared to AF and is fairly simple to use
2.AFNetworking
It encapsulates the components of the Nsurlconnection network, and after IOS7, afnetworking encapsulates the network components of the nsurlsession.
GitHub address, this is its, should look at the relevant documents before downloading, in today's development cocoapod use also many, so want to be able to download from Cocoapod
As to how to install cocoapod installation, there are a lot of related tutorials online, you can go to Baidu to see, recommend to see this http://www.jianshu.com/p/3f6bbe3130cc
3 Afnetworking Related classes
Nsurlconnection Core Network Requests
Nsurlsession Background tasks for iOS7
Rechability is used to detect changes in network loading, which can be caozuo in different network environments.
Serialization serializable {for Request and Response object Encapsulation}
Security for the sslpinning package for communication
4 Network-related download and upload operations
Afhttpsessionmanager: For managing network requests, downloads, uploads, etc.
Download file operation
Upload file operation
In Afhttpsessionmanager, use the Mananger class method to create, do not support the background of the download, upload
If you need to do a background download can be implemented in the following ways
5.AFHTTPRequestSerializer
In the client, the data format that is submitted to the server is mainly: stitching, JSON
Afhttprequestserializer:& Assembly format
Afjsonrequestserializer:json data format
The relationship between the two of them is
6AFUELResponseSerialozation
The data format returned by the server has two main types of JSON and XML
AF encapsulates the corresponding class-to-return data parsing
Afhttpresponseserializer: Do not parse data
Afjsonresponseserializer: Parsing JSON data format
Afxmlparserresponseserializer: Parsing XML data formats
The relationship between the three is
7 Set request, return data format via Afhttpsessionmanager object
Afnetworkingreachabilitymanager for monitoring network status, network type
The implementation code is as follows
8UIKit of network expansion
AF for the class provides a set of category methods for network requests
iOS Network Programming Summary