Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSURLSessionMBS class.

NSURLSessionMBS.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 the class is available.

Returns true on MacOS 10.9 or newer.

NSURLSessionMBS.sharedSession as NSURLSessionMBS

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

For basic requests, the NSURLSessionMBS class provides a shared singleton session object that gives you a reasonable default behavior for creating tasks. Use the shared session to fetch the contents of a URL to memory with just a few lines of code.
Unlike the other session types, you don’t create the shared session; you merely access it by using this property directly. As a result, you don’t provide a delegate or a configuration object.

Limitations of the Shared Session
Because the shared session has neither a delegate nor a customizable configuration object, the shared session has important limitations:

  • You can’t obtain data incrementally as it arrives from the server.
  • You can’t significantly customize the default connection behavior.
  • Your ability to perform authentication is limited.
  • You can’t perform background downloads or uploads when your app isn’t running.

The shared session uses the shared NSURLCacheMBS, NSHTTPCookieStorageMBS, and NSURLCredentialStorageMBS objects, uses a shared custom networking protocol lis, and is based on a default configuration.

In general, when working with a shared session, you should avoid customizing the cache, cookie storage, or credential storage (unless you are already doing so with NSURLConnectionMBS). There’s a good chance that you’ll outgrow the capabilities of the default session, at which point you’ll have to rewrite all of those customizations to work with your custom URL sessions.
In other words, if you’re doing anything with caches, cookies, authentication, or custom networking protocols, you should probably be using a default session instead of the shared session.

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


The biggest plugin in space...