<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSApplicationDelegate",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSApplicationDelegate"
  },
  "title" : "NSApplicationDelegate"
}
-->

# NSApplicationDelegate

A set of methods that manage your app’s life cycle and its interaction with common system services.

```
protocol NSApplicationDelegate : NSObjectProtocol
```

## Topics

### Launching Applications

[`-  applicationWillFinishLaunching:`](/documentation/AppKit/NSApplicationDelegate/applicationWillFinishLaunching(_:))

Tells the delegate that the app’s initialization is about to complete.

[`-  applicationDidFinishLaunching:`](/documentation/AppKit/NSApplicationDelegate/applicationDidFinishLaunching(_:))

Tells the delegate that the app’s initialization is complete but it hasn’t received its first event.

[NSApplicationDidFinishLaunching User Info Keys](/documentation/AppKit/nsapplicationdidfinishlaunching-user-info-keys)

The keys you use to access values in the launch options dictionary that the system passes to your app at initialization.

### Managing Active Status

[`-  applicationWillBecomeActive:`](/documentation/AppKit/NSApplicationDelegate/applicationWillBecomeActive(_:))

Tells the delegate that the app is about to become active.

[`-  applicationDidBecomeActive:`](/documentation/AppKit/NSApplicationDelegate/applicationDidBecomeActive(_:))

Tells the delegate that the app is now active.

[`-  applicationWillResignActive:`](/documentation/AppKit/NSApplicationDelegate/applicationWillResignActive(_:))

Tells the delegate that the app is about to become inactive and will lose focus.

[`-  applicationDidResignActive:`](/documentation/AppKit/NSApplicationDelegate/applicationDidResignActive(_:))

Tells the delegate that the app is no longer active and doesn’t have focus.

### Terminating Applications

[`-  applicationShouldTerminate:`](/documentation/AppKit/NSApplicationDelegate/applicationShouldTerminate(_:))

Returns a value that indicates if the app should terminate.

[`TerminateReply`](/documentation/AppKit/NSApplication/TerminateReply)

Constants that determine whether an app should terminate.

[`-  applicationShouldTerminateAfterLastWindowClosed:`](/documentation/AppKit/NSApplicationDelegate/applicationShouldTerminateAfterLastWindowClosed(_:))

Returns a Boolean value that indicates if the app terminates once the last window closes.

[`-  applicationWillTerminate:`](/documentation/AppKit/NSApplicationDelegate/applicationWillTerminate(_:))

Tells the delegate that the app is about to terminate.

### Hiding Applications

[`-  applicationWillHide:`](/documentation/AppKit/NSApplicationDelegate/applicationWillHide(_:))

Tells the delegate that the app is about to be hidden.

[`-  applicationDidHide:`](/documentation/AppKit/NSApplicationDelegate/applicationDidHide(_:))

Tells the delegate that the app is now hidden.

[`-  applicationWillUnhide:`](/documentation/AppKit/NSApplicationDelegate/applicationWillUnhide(_:))

Tells the delegate that the app is about to become visible.

[`-  applicationDidUnhide:`](/documentation/AppKit/NSApplicationDelegate/applicationDidUnhide(_:))

Tells the delegate that the app is now visible.

### Managing Windows

[`-  applicationWillUpdate:`](/documentation/AppKit/NSApplicationDelegate/applicationWillUpdate(_:))

Tells the delegate that the app is about to update its windows.

[`-  applicationDidUpdate:`](/documentation/AppKit/NSApplicationDelegate/applicationDidUpdate(_:))

Tells the delegate that the app’s windows did update.

[`-  applicationShouldHandleReopen:hasVisibleWindows:`](/documentation/AppKit/NSApplicationDelegate/applicationShouldHandleReopen(_:hasVisibleWindows:))

Returns a Boolean value that indicates if the app responds to reopen AppleEvents.

### Managing the Dock Menu

[`-  applicationDockMenu:`](/documentation/AppKit/NSApplicationDelegate/applicationDockMenu(_:))

Returns the app’s dock menu.

### Localizing Keyboard Shortcuts

[`-  applicationShouldAutomaticallyLocalizeKeyEquivalents:`](/documentation/AppKit/NSApplicationDelegate/applicationShouldAutomaticallyLocalizeKeyEquivalents(_:))

Returns a Boolean value that tells the system whether to remap menu shortcuts to support localized keyboards.

### Displaying Errors

[`-  application:willPresentError:`](/documentation/AppKit/NSApplicationDelegate/application(_:willPresentError:))

Returns an error for the app to display to the user.

### Managing the Screen

[`-  applicationDidChangeScreenParameters:`](/documentation/AppKit/NSApplicationDelegate/applicationDidChangeScreenParameters(_:))

Tells the delegate about changes to the configuration of any attached displays.

### Continuing User Activities

[`-  application:willContinueUserActivityWithType:`](/documentation/AppKit/NSApplicationDelegate/application(_:willContinueUserActivityWithType:))

Returns a Boolean value that indicates if the app can continue the specified activity.

[`-  application:continueUserActivity:restorationHandler:`](/documentation/AppKit/NSApplicationDelegate/application(_:continue:restorationHandler:))

Returns a Boolean value that indicates if the app successfully recreates the specified activity.

[`-  application:didFailToContinueUserActivityWithType:error:`](/documentation/AppKit/NSApplicationDelegate/application(_:didFailToContinueUserActivityWithType:error:))

Tells the delegate that the app couldn’t continue the specified activity.

[`-  application:didUpdateUserActivity:`](/documentation/AppKit/NSApplicationDelegate/application(_:didUpdate:))

Tells the delegate that there are changes to the specified activity.

### Handling Push Notifications

[`-  application:didRegisterForRemoteNotificationsWithDeviceToken:`](/documentation/AppKit/NSApplicationDelegate/application(_:didRegisterForRemoteNotificationsWithDeviceToken:))

Tells the delegate that the app registered for Apple Push Services.

[`-  application:didFailToRegisterForRemoteNotificationsWithError:`](/documentation/AppKit/NSApplicationDelegate/application(_:didFailToRegisterForRemoteNotificationsWithError:))

Tells the delegate that the app was unable to register for Apple Push Services.

[`-  application:didReceiveRemoteNotification:`](/documentation/AppKit/NSApplicationDelegate/application(_:didReceiveRemoteNotification:))

Tells the delegate when the app receives a remote notification.

### Handling CloudKit Invitations

[`-  application:userDidAcceptCloudKitShareWithMetadata:`](/documentation/AppKit/NSApplicationDelegate/application(_:userDidAcceptCloudKitShareWith:))

Tells the delegate when the user accepts a CloudKit sharing invitation.

### Handling SiriKit Intents

[`-  application:handlerForIntent:`](/documentation/AppKit/NSApplicationDelegate/application(_:handlerFor:))

Returns an intent handler that’s capable of handling the specified intent.

### Opening Files

[`-  application:openURLs:`](/documentation/AppKit/NSApplicationDelegate/application(_:open:))

Tells the delegate to open the resource at the specified URL.

[`-  application:openFile:`](/documentation/AppKit/NSApplicationDelegate/application(_:openFile:))

Returns a Boolean value that indicates if the app opens the specified file.

[`-  application:openFileWithoutUI:`](/documentation/AppKit/NSApplicationDelegate/application(_:openFileWithoutUI:))

Returns a Boolean value that indicates if the app opens the specified file without showing its user interface.

[`-  application:openTempFile:`](/documentation/AppKit/NSApplicationDelegate/application(_:openTempFile:))

Returns a Boolean value that indicates if the app opens the specified temporary file.

[`-  application:openFiles:`](/documentation/AppKit/NSApplicationDelegate/application(_:openFiles:))

Tells the delegate to open the specified files.

[`-  applicationShouldOpenUntitledFile:`](/documentation/AppKit/NSApplicationDelegate/applicationShouldOpenUntitledFile(_:))

Returns a Boolean value that indicates if the app can open an untitled file.

[`-  applicationOpenUntitledFile:`](/documentation/AppKit/NSApplicationDelegate/applicationOpenUntitledFile(_:))

Returns a Boolean value that indicates if the app opens an untitled file.

### Printing

[`-  application:printFile:`](/documentation/AppKit/NSApplicationDelegate/application(_:printFile:))

Returns a Boolean value that indicates if the app prints the specified file in its entirety.

[`-  application:printFiles:withSettings:showPrintPanels:`](/documentation/AppKit/NSApplicationDelegate/application(_:printFiles:withSettings:showPrintPanels:))

Returns a value that indicates if the app prints the specified files.

[`PrintReply`](/documentation/AppKit/NSApplication/PrintReply)

Constants that indicate the outcome of a print request.

### Restoring Application State

[`-  applicationSupportsSecureRestorableState:`](/documentation/AppKit/NSApplicationDelegate/applicationSupportsSecureRestorableState(_:))

Returns a Boolean value that indicates if the app supports secure state restoration.

[`-  applicationProtectedDataDidBecomeAvailable:`](/documentation/AppKit/NSApplicationDelegate/applicationProtectedDataDidBecomeAvailable(_:))

Tells the delegate that protected data is now available.

[`-  applicationProtectedDataWillBecomeUnavailable:`](/documentation/AppKit/NSApplicationDelegate/applicationProtectedDataWillBecomeUnavailable(_:))

Tells the delegate that protected data is about to become unavailable.

[`-  application:willEncodeRestorableState:`](/documentation/AppKit/NSApplicationDelegate/application(_:willEncodeRestorableState:))

Tells the delegate that the app is about to encode its restorable state.

[`-  application:didDecodeRestorableState:`](/documentation/AppKit/NSApplicationDelegate/application(_:didDecodeRestorableState:))

Tells the delegate when the app finished decoding its restorable state.

### Handling Changes to the Occlusion State

[`-  applicationDidChangeOcclusionState:`](/documentation/AppKit/NSApplicationDelegate/applicationDidChangeOcclusionState(_:))

Tells the delegate about changes to the app’s occlusion state.

### Scripting Your App

[`-  application:delegateHandlesKey:`](/documentation/AppKit/NSApplicationDelegate/application(_:delegateHandlesKey:))

Returns a Boolean value that indicates if the app supports the specified scripting key.

### Type Methods

[`main()`](/documentation/AppKit/NSApplicationDelegate/main())

Provides the top-level entry point for the app.

## Relationships

### Inherits From

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

---

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)