Network Programming for iOS development-6. NSURLSessionConfiguration notes, nsurlsession

Source: Internet
Author: User

Network Programming for iOS development-6. NSURLSessionConfiguration notes, nsurlsession

 

The NSURLSessionConfiguration object is used to initialize the NSURLSession object.

Expand the alternative scheme related to NSMutableURLRequest at the request level. We can see that NSURLSessionConfiguration provides a considerable amount of control and flexibility for generating requests for sessions. From network access performance, to cookies, security, cache policies, custom protocols, startup event settings, and several new attributes used for mobile device optimization, you will find that you are always looking, it is the NSURLSessionConfiguration.

Sessions copy their configurations during initialization. NSURLSession has a read-only Configuration Attribute, which invalidates the policy of this session due to changes in the configuration object. The configuration is read once during initialization and will not change after initialization.

-Constructor

NSURLSessionConfiguration has three class constructor functions, which demonstrates that NSURLSession is designed for different use cases.

+ "Defasessessionconfiguration" returns the standard configuration, which is actually the same as the network protocol stack of NSURLConnection. It shares the same NSHTTPCookieStorage, NSURLCache, and NSURLCredentialStorage.
+ "EphemeralSessionConfiguration" returns a preset configuration with no persistent storage cache, Cookie, or certificate. This is ideal for implementing features like "private browsing.
+ "BackgroundSessionConfiguration": it creates a background session. Background sessions are different from conventional and common sessions. They can even run upload and download tasks when the application is suspended, exited, or crashed. The identifier specified during initialization. It is used to provide context to any daemon that may resume background transmission outside the process.

Want to view

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.