<!--
{
  "availability" : [
    "macCatalyst: -",
    "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.

[`NSApplication.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(_:continue: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(_:didUpdate:)`](/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(_:userDidAcceptCloudKitShareWith:)`](/documentation/AppKit/NSApplicationDelegate/application(_:userDidAcceptCloudKitShareWith:))

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

### Handling SiriKit Intents

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

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

### Opening Files

[`application(_:open:)`](/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.

[`NSApplication.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.



---

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)
