Platforms to show: All Mac Windows Linux Cross-Platform

NSURLSessionConfigurationMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Cocoa Networking MBS MacFrameworks Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Function: A configuration object that defines behavior and policies for a URL session.
Notes:
An NSURLSessionConfigurationMBS object defines the behavior and policies to use when uploading and downloading data using an NSURLSessionMBS object. When uploading or downloading data, creating a configuration object is always the first step you must take. You use this object to configure the timeout values, caching policies, connection requirements, and other types of information that you intend to use with your NSURLSessionMBS object.

It is important to configure your NSURLSessionConfigurationMBS object appropriately before using it to initialize a session object. Session objects make a copy of the configuration settings you provide and use those settings to configure the session. Once configured, the session object ignores any changes you make to the NSURLSessionConfigurationMBS object. If you need to modify your transfer policies, you must update the session configuration object and use it to create a new NSURLSessionMBS object.

Note
In some cases, the policies defined in this configuration may be overridden by policies specified by an NSURLRequestMBS object provided for a task. Any policy specified on the request object is respected unless the session’s policy is more restrictive. For example, if the session configuration specifies that cellular networking should not be allowed, the NSURLRequestMBS object cannot request cellular networking.

For more information about using configuration objects to create sessions, see NSURLSessionMBS class.

Types of Session Configurations

The behavior and capabilities of a URL session are largely determined by the kind of configuration used to create the session.

The singleton shared session (which has no configuration object) is for basic requests. It’s not as customizable as sessions that you create, but it serves as a good starting point if you have very limited requirements. You access this session by calling the shared class method. See that method’s discussion for more information about its limitations.

Default sessions behave much like the shared session (unless you customize them further), but let you obtain data incrementally using a delegate. You can create a default session configuration by calling the default method on the URLSessionConfiguration class.

Ephemeral sessions are similar to default sessions, but they don’t write caches, cookies, or credentials to disk. You can create an ephemeral session configuration by calling the ephemeral method on the URLSessionConfiguration class.

Background sessions let you perform uploads and downloads of content in the background while your app isn’t running. You can create a background session configuration by calling the backgroundSessionConfiguration(_:) method on the URLSessionConfiguration class.

Feedback, Comments & Corrections

Cache Policy

Constant Value Description
CachePolicyReloadIgnoringCacheData 1 The URL load should be loaded only from the originating source.
CachePolicyReloadIgnoringLocalAndRemoteCacheData 4 Ignore local cache data, and instruct proxies and other intermediates to disregard their caches so far as the protocol allows.
CachePolicyReloadIgnoringLocalCacheData 1 The URL load should be loaded only from the originating source.
CachePolicyReloadRevalidatingCacheData 5 Use cache data if the origin source can validate it; otherwise, load from the origin.
CachePolicyReturnCacheDataDontLoad 3 Use existing cache data, regardless or age or expiration date, and fail if no cached data is available.
CachePolicyReturnCacheDataElseLoad 2 Use existing cache data, regardless or age or expiration date, loading from originating source only if there is no cached data.
CachePolicyUseProtocolCachePolicy 0 Use the caching logic defined in the protocol implementation, if any, for a particular URL load request.

Cookie Accept Policy

Constant Value Description
CookieAcceptPolicyAlways 0 Accept all cookies. This is the default cookie accept policy.
CookieAcceptPolicyNever 1 Reject all cookies.
CookieAcceptPolicyOnlyFromMainDocumentDomain 2 Accept cookies only from the main document domain.

Multipath TCP Modes

Constant Value Description
MultipathServiceTypeAggregate 3 A service that aggregates the capacities of other Multipath options in an attempt to increase throughput and minimize latency.
MultipathServiceTypeHandover 1 A Multipath TCP service that provides seamless handover between Wi-Fi and cellular in order to preserve the connection.
MultipathServiceTypeInteractive 2 A service whereby Multipath TCP attempts to use the lowest-latency interface.
MultipathServiceTypeNone 0 The default service type indicating that Multipath TCP should not be used.

Network Service Types

Constant Value Description
NetworkServiceTypeAVStreaming 8 A service type for streaming audio/video data.
NetworkServiceTypeBackground 3 A service type for background traffic.
You should specify this type if your app is performing a download that was not requested by the user—for example, prefetching content so that it will be available when the user chooses to view it.
NetworkServiceTypeCallSignaling 11 A service type for call signaling.
Use this service type with network traffic that establishes, maintains, or tears down a VoIP call. Use the NSURLNetworkServiceTypeVoIP type for the actual media of a call.
NetworkServiceTypeDefault 0 A service type for standard network traffic.
NetworkServiceTypeResponsiveAV 9 A service type for responsive (time-sensitive) audio/video data.
NetworkServiceTypeResponsiveData 6 A service type for data that the user is actively waiting for.
This service type’s priority is higher than NSURLNetworkServiceTypeDefault. Use this service type for interactive situations where the user is anticipating a quick response, like instant messaging or completing a purchase.
NetworkServiceTypeVideo 2 A service type for video traffic.
NetworkServiceTypeVoice 4 A service type for voice traffic.
NetworkServiceTypeVoIP 1 A service type for VoIP traffic.
With the VoIP service type, the kernel continues to listen for incoming traffic while your app is in the background, then wakes up your app whenever new data arrives. This should be used only for connections that are used to communicate with a VoIP service.

This class has no sub classes.

Some methods using this class:

Some properties using for this class:

Some examples using this class:

Blog Entries


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


NSURLResponseMBS   -   NSURLSessionDataTaskMBS

The biggest plugin in space...




Links
MBS Xojo PDF Plugins

Start Chat