IOS nsurlsession VS nsurlconnection

Source: Internet
Author: User

nsurlsession VS nsurlconnection
Nsurlsession can be seen as an evolutionary version of Nsurlconnection, and its improvements to Nsurlconnection are:

    • * Configure on a per session basis (HTTP header,cache,cookie,protocal,credential) and no longer share configurations across the app level.
    • * Support for network operation cancellation and breakpoint continuation
    • * Improved handling of authorization mechanisms
    • * A rich delegate model
    • * Separation of real data and network configuration data.
    • * Background processing upload and download, even if you click on the "Home" button, the background can still continue to download, and provides a configuration based on the network condition, the power situation to handle.


Knowledge points



usage
The general routines for using Nsurlsession are as follows:

      • 1. Define a Nsurlrequest
      • 2. Define a nsurlsessionconfiguration, configure various network parameters
      • 3. Use Nsurlsession's factory method to obtain a desired type of nsurlsession
      • 4. Use defined Nsurlrequest and nsurlsession to build a nsurlsessiontask
      • 5. Use delegate or Completionhandler to handle all events of the task execution process.

IOS nsurlsession VS nsurlconnection

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.