Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSURLSessionConfigurationMBS class.

NSURLSessionConfigurationMBS.available as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Networking MBS MacFrameworks Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Whether this class is available.

Returns true on MacOS 10.9 or newer.
A lot of properties require higher MacOS versions.

NSURLSessionConfigurationMBS.backgroundSessionConfiguration(identifier as String) as NSURLSessionConfigurationMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Networking MBS MacFrameworks Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a session configuration object that allows HTTP and HTTPS uploads or downloads to be performed in the background.

identifier: The unique identifier for the configuration object. This parameter must not be nil or an empty string.

Returns a configuration object that causes the system to perform upload and download tasks in a separate process.

Use this method to initialize a configuration object suitable for transferring data files while the app runs in the background. A session configured with this object hands control of the transfers over to the system, which handles the transfers in a separate process. In iOS, this configuration makes it possible for transfers to continue even when the app itself is suspended or terminated.

If an iOS app is terminated by the system and relaunched, the app can use the same identifier to create a new configuration object and session and to retrieve the status of transfers that were in progress at the time of termination. This behavior applies only for normal termination of the app by the system. If the user terminates the app from the multitasking screen, the system cancels all of the session’s background transfers. In addition, the system does not automatically relaunch apps that were force quit by the user. The user must explicitly relaunch the app before transfers can begin again.

You can configure an background session to schedule transfers at the discretion of the system for optimal performance using the discretionary property. When transferring large amounts of data, you are encouraged to set the value of this property to true. For an example of using the background configuration, see Downloading Files in the Background.

Requires MacOS 10.10 or newer.

NSURLSessionConfigurationMBS.defaultSessionConfiguration as NSURLSessionConfigurationMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Networking MBS MacFrameworks Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes All
A default session configuration object.

The default session configuration uses a persistent disk-based cache (except when the result is downloaded to a file) and stores credentials in the user’s keychain. It also stores cookies (by default) in the same shared cookie store as the NSURLConnectionMBS and NSURLDownloadMBS classes.

If you’re porting code based on the NSURLConnectionMBS class, use this method to obtain an initial configuration object and then customize that object as needed.

Modifying the returned session configuration object does not affect any configuration objects returned by future calls to this method, and does not change the default behavior for existing sessions. It is therefore always safe to use the returned object as a starting point for additional customization.

NSURLSessionConfigurationMBS.ephemeralSessionConfiguration as NSURLSessionConfigurationMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa Networking MBS MacFrameworks Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes All
A session configuration that uses no persistent storage for caches, cookies, or credentials.

An ephemeral session configuration object is similar to a default session configuration (see defaultSessionConfiguration), except that the corresponding session object doesn’t store caches, credential stores, or any session-related data to disk. Instead, session-related data is stored in RAM. The only time an ephemeral session writes data to disk is when you tell it to write the contents of a URL to a file.

It is possible to customize a default session configuration object to obtain the same behavior (or any portion thereof) provided by an ephemeral session configuration object, but the use of this method is more convenient.

Privacy and Performance Considerations
The main advantage to using ephemeral sessions is privacy. By not writing potentially sensitive data to disk, you make it less likely that the data will be intercepted and used later. For this reason, ephemeral sessions are ideal for private browsing modes in web browsers and other similar situations.
Because an ephemeral session doesn’t write cached data to disk, the size of the cache is limited by available RAM. This limitation means that previously fetched resources are less likely to be in the cache (and are guaranteed to not be there if the user quits and relaunches your app). This behavior may reduce perceived performance, depending on your app.
When your app invalidates the session, all ephemeral session data is purged automatically. Additionally, in iOS, the in-memory cache isn’t purged automatically when your app is suspended but may be purged when your app is terminated or when the system experiences memory pressure.

The items on this page are in the following plugins: MBS MacFrameworks Plugin.


The biggest plugin in space...