Most of today's applications are based on the network, in the open source China iOS client source code on the network communication in three libraries, ASI and afnetworking, there is an Apple official reachability to detect the current network conditions, this article describes the current use of the more ASI class library ;
ASIHTTPRequest, an ASI, encapsulates the Cfnetwork API, making it easier to make the tedious steps of communicating with a Web server. It is written using objective-c and can be well used in Mac OS X and iphone applications, and it is suitable for performing basic HTTP requests and interacting on a rest based service (Get/post/put/delete).
ASIHTTPRequest Download Https://github.com/pokeb/asi-http-request/tree
Introduction of ASI Class Library in http://allseeing-i.com/ASIHTTPRequest/
Add ASI to your project step http://allseeing-i.com/ASIHTTPRequest/Setup-instructions
ASI Features
L COMPLETE the work of submitting data to the server and obtaining data from the server through a simple interface
L downloaded data that can be stored in memory or stored directly on disk
L can upload local files to the server
• Easy access to and operation of requests and returned HTTP header information
L can get progress information on upload or download and provide a better experience for the application
L support upload or download queues, and can get progress information for queues
L Support Basic, Digest, and NTLM authentication, the authorization credentials are maintained automatically in the same session, and can be stored in keychain (Mac and iOS operating system Password management systems)
L Support Cookies
L The request can continue to run when the application (ios4+) is running in the background
L Support gzip Compression data
L A built-in Asidownloadcache class that caches data returned by a request so that the cached data results can be returned even if no network is available
L asiwebpagerequest– can download complete Web pages, including Web pages, stylesheets, scripts, and other resource files, and display them in Uiwebview/webview. Pages of any size can be cached indefinitely so that they can be browsed offline even without a network
L Support Client Certificates
L support HTTP requests via Proxy
L Support Bandwidth throttling. On the iOS platform, you can automatically decide whether to limit bandwidth based on current network conditions, such as when using Wwan (GPRS/EDGE/3G) networks, and without any restrictions when using WiFi
L Support Breakpoint Continuation
L Support Synchronous and asynchronous please
ASI class Library includes 22 files, 4 main classes ASIHTTPRequest, Asiformdatarequest, Asinetworkqueue, asidownloadcache,5 supported classes Asiinputstream, Asidatadecompressor, Asidatacompressor, Asiauthenticationdialog, reachability,4 protocol configuration file Asihttprequestdelegate, Asiprogressdelegate, Asicachedelegate, ASIHTTPRequestConfig.h, these file roles are described in detail in the development documentation.
There is a simple use of http://allseeing-i.com/ASIHTTPRequest/How-to-use in the first contact with ASI, it is necessary to take a look at
Learn about simple sync requests, asynchronous requests, block requests, queue requests, and other uses.