What is the difference between the ASI and AFN iOS (2)

Source: Internet
Author: User

What is the difference between ASI and AFN?

1. Performance (Focus)

* ASI based on the underlying cfnetwork framework

* AFN based on nsurlconnection

* Operating performance: ASI > ASN

2. Processing server data

1> AFN: Automatic parsing based on data returned by the server

* The server returns JSON data, automatically converted to nsdictionary or Nsarray

* The server returns XML data and is automatically converted to Nsxmlparser

2> ASI: Does not parse the server data, directly returns the NSData binary data

3. Process of processing requests

1> afn:success and failure two blocks

2> ASI: There are 3 ways to handle the request process (proxy method \sel\block)

Features of 3.ASI (emphasis)

1> Cache

2> Download and upload

* Easy monitoring of Request progress

* Easy to implement breakpoint download (ASI does not have breakpoint upload function, breakpoint upload to use socket technology)

3> provides a number of expansion interfaces (such as data compression)

* ASIDataCompressor.h

* ASIDataDecompressor.h

4> asihttprequest inherit from Nsoperation

* All requests can be managed uniformly by queue

* Requests can depend on each other

5> Asinetworkqueue

* Unified management of all requests

* 5 downloads \ Upload Request-Asinetworkqueue: Monitor total progress of 5 requests

* Listen for all requests start \ Fail \ Complete

* Shouldcancelallrequestsonfailure

YES: A request in the queue failed and all other requests were canceled

No: One of the requests in the queue failed, the other requests are not affected, and the request continues

Features of 4.AFN

1> Easy to use

2> comes with a network monitoring function

What is the difference between the ASI and AFN iOS (2)

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.