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