One Logo Pool Ball
Foundation · IOS API REFERENCE

NSExtensionContext.DidEnterBackgroundMessage

struct · iOS 26.0+ · SDK 27.1

struct DidEnterBackgroundMessage

A message the system sends when the extension’s host app begins running in the background. You can use this message in your extension to stop tasks and prepare for the system to suspend the extension. Extensions receive only a short amount of time to perform any background work. If you need more time to complete critical tasks, use the methods of the ``ProcessInfo`` class to request that time. Observe this message with the identifier ``NotificationCenter/MessageIdentifier/didEnterBackground-5gdtk``, or specify its type directly to the `addObserver(of:for:using:)` method. The ``NotificationCenter/MainActorMessage/Subject`` of this message type is ``NSExtensionContext``. This message interoperates with the notification ``NSNotification/Name/NSExtensionHostDidEnterBackground``. The system notifies observers of the message when the ``NotificationCenter`` posts the notification. Similarly, the system notifies observers of the notification when it posts the message.

Members (3)

static · iOS 26.0+

makeMessage

TypeScript
static makeMessage(notification: Notification): Promise<(NSExtensionContext_DidEnterBackgroundMessage) | null>
Swift declaration
@MainActor static func makeMessage(_ notification: Notification) -> NSExtensionContext.DidEnterBackgroundMessage?

Converts a posted notification into this main actor message type for any observers. To implement this method in your own `MainActorMessage` conformance, retrieve values from the ``Notification``'s ``Notification/userInfo`` and set them as properties on the message. - Parameter notification: The posted ``Notification``. - Returns: The converted `MainActorMessage` or `nil` if conversion is not possible.

get · iOS 26.0+

name

TypeScript
static get nameValue(): NSNotification_Name
Swift declaration
static var name: Notification.Name { get }

A optional name corresponding to this type, used to interoperate with notification posters and observers.

init · iOS 26.0+

init

TypeScript
static init(): NSExtensionContext_DidEnterBackgroundMessage
Swift declaration
init()

Creates a message for a host app entering the background.

Skipped declarations

No declarations were skipped in this snapshot.

All Foundation types →