The difference between ASI and AFN in iOS

Source: Internet
Author: User

First, the bottom realization

1> AFN based on OC Nsurlconnection and Nsurlsession

2> ASI's underlying cfnetwork framework based on pure C language

3> ASI has a higher operating performance than AFN

Ii. data processing for the return of the server

1> ASI does not provide direct data processing to the server, directly returning data\string

2> AFN provides a variety of ways to process server data

* JSON processing

* XML processing

* Other processing

Third, the process of monitoring the request

1> AFN provides success and failure two blocks to listen for requests (only for success and failure)

* Success: Call after successful request

* Failure: Call after request failed

The 2> ASI offers 3 solutions, each of which listens to the complete process of the request.

(Listener requests Start, receive response header information, receive specific data, accept, request failed)

* Become an agent, abide by the agreement, implement the agent method in the Agreement

* Become an agent, do not comply with the protocol, custom proxy methods

* Set block

Iv. Ease of use in file downloads and file uploads

1> AFN

* Not easy to listen to download progress and upload progress

* Not easy to implement a breakpoint continuation

* Generally only used to download a small file

2> ASI

* Very easy to download and upload

* Very easy to listen to download progress and upload progress

* Very easy to implement the breakpoint continued to pass

* Download or large or small files are OK

Five, ASI provides more practical functions

1> Control Circle do not relay in the request process

2> can easily set dependencies between requests: Each request is a Nsoperation object

3> can manage all requests uniformly (also specifically providing a call to Asinetworkqueue to manage all request objects)

* Pause \ Resume \ Cancel all requests

* Monitor the download progress and upload progress of all requests in the entire queue

The difference between ASI and AFN in iOS

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.