<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSExtensionContext/DidEnterBackgroundMessage",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:So18NSExtensionContextC10FoundationE25DidEnterBackgroundMessageV"
  },
  "title" : "NSExtensionContext.DidEnterBackgroundMessage"
}
-->

# NSExtensionContext.DidEnterBackgroundMessage

A message the system sends when the extension’s host app begins running in the background.

```
struct DidEnterBackgroundMessage
```

## Overview

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`](/documentation/Foundation/ProcessInfo) class to request that time.

Observe this message with the identifier [`didEnterBackground`](/documentation/Foundation/NotificationCenter/MessageIdentifier/didEnterBackground-5gdtk), or specify its type directly to the `addObserver(of:for:using:)` method.
The [`Subject`](/documentation/Foundation/NotificationCenter/MainActorMessage/Subject) of this message type is [`NSExtensionContext`](/documentation/Foundation/NSExtensionContext).

This message interoperates with the notification [`NSExtensionHostDidEnterBackground`](/documentation/Foundation/NSNotification/Name-swift.struct/NSExtensionHostDidEnterBackground).
The system notifies observers of the message when the [`NotificationCenter`](/documentation/Foundation/NotificationCenter) posts the notification.
Similarly, the system notifies observers of the notification when it posts the message.

## Topics

### Creating a message for a host app entering the background

[`init()`](/documentation/Foundation/NSExtensionContext/DidEnterBackgroundMessage/init())

Creates a message for a host app entering the background.

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

[`MainActorMessage`](/documentation/Foundation/NotificationCenter/MainActorMessage)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)