The difference between IOS ASI and AFN

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 returns the 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 IOS ASI and AFN

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.