Contents

NSExtensionContext.DidEnterBackgroundMessage

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

Declaration

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 class to request that time.

Observe this message with the identifier didEnterBackground, or specify its type directly to the addObserver(of:for:using:) method. The Subject of this message type is NSExtensionContext.

This message interoperates with the notification 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.

Topics

Creating a message for a host app entering the background

See Also

Working with notification messages