<!--
{
  "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/WillResignActiveMessage",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:So18NSExtensionContextC10FoundationE23WillResignActiveMessageV"
  },
  "title" : "NSExtensionContext.WillResignActiveMessage"
}
-->

# NSExtensionContext.WillResignActiveMessage

A message the system sends when the extension’s host app moves from the active to the inactive state.

```
struct WillResignActiveMessage
```

## Overview

Your extension can use this message to adjust the extension’s activity when it becomes inactive.
For example, you might use this message to save any unsaved data to prevent it from being lost.

Observe this message with the identifier [`willResignActive`](/documentation/Foundation/NotificationCenter/MessageIdentifier/willResignActive-9z4xc), 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 [`NSExtensionHostWillResignActive`](/documentation/Foundation/NSNotification/Name-swift.struct/NSExtensionHostWillResignActive).
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 becoming inactive

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

Creates a message for a host app becoming inactive.

## Relationships

### Conforms To

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

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

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

---

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)