IOS third-party open Source Library----->afnetworking

Source: Internet
Author: User
Tags uikit

afnetworking

Afnetworking is a delightful network library made for IOS and Mac OSX, built on top of the framework of the URL loading system, embedded in the cocoa, extending the powerful advanced network abstraction. Its modular architecture is well designed and has a rich range of functions, so it is certainly pleasing to use.

Original link https://github.com/AFNetworking/AFNetworking

Introduced

1. Support for HTTP requests and rest-based network services (including GET, POST, PUT, delete, etc.)
2. Support Arc
3. Requires iOS 5.0 and later

4.UIKit expansion

Configuration

1. Download the afnetworking and drag 2 folders: afnetworking and uikit+afnetworking into the project

2. Import the following library files: cfnetwork, Security, SystemConfiguration, mobilecoreservices

3. If you have previously used version 1.0, then Afnetworking 2.0 Migration Guide can help you

4. If you are configuring with Cocoapods, then

Platform:ios, ' 7.0 '

Pod "afnetworking", "~>2.0"

Use

1.HTTP Request operation

The common pattern of Afhttprequestoperationmanager encapsulation communicates with Web applications over HTTP, including creation of requests, response serialization, network accessibility monitoring, operational management and security, and requests.

GET request

POST request

 POST request (multiple tables)

2.AFURLSessionManager (Nsurlsession Detailed network programming (6))

Creation and management of Nsurlsession objects Nsurlsessionconfiguration objects must be implemented <nsurlsessiontaskdelegate>, < Nsurlsessiondatadelegate>, <nsurlsessiondownloaddelegate>, <NSURLSessionDelegate> Agreement

Create a download task

Create an upload task

Create an upload task with multiple tables and progress

Create a dataflow data task

3. Network monitoring (usually with another network monitoring class, reachability, and JSON parsing method, anyway I also generally do not, self-brain repair)

The Afnetworkreachabilitymanager monitors the accessibility of the network domain, the Wwan address and the WiFi interface.

Current network status


HTTP Manager Accessibility

4.AFHTTPRequestOperation

Afhttprequestoperation is a subclass of Afurlconnectionoperation that uses the HTTP or HTTPS protocol.
The acquired HTTP state and type of the package it encapsulates will determine the success or not of the request. Although Afhttprequestoperationmanager is usually the best way to request it, afhttprequestopersion can also be used alone.
GET request

Bulk Multi-Request

Other information

1. Official website

2. English documents

IOS third-party open Source Library----->afnetworking

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.