---
title: "registerForRemoteNotifications(matching:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsapplication/registerforremotenotifications(matching:)"
---

# registerForRemoteNotifications(matching:)

Register to receive notifications of the specified types from a provider through the Apple Push Notification service.

## Declaration

```swift
func registerForRemoteNotifications(matching types: NSApplication.RemoteNotificationType)
```

## Parameters

- `types`: A bit mask specifying the types of notifications the app accepts. See doc://com.apple.appkit/documentation/AppKit/NSApplication/RemoteNotificationType for valid bit-mask values.

## Discussion

Discussion note: Use registerForRemoteNotifications() instead. When you send this message, the device initiates the registration process with Apple Push Notification Service. If it succeeds, the app delegate receives a device token in the application(_:didRegisterForRemoteNotificationsWithDeviceToken:) method; if registration doesn’t succeed, the delegate is informed via the application(_:didFailToRegisterForRemoteNotificationsWithError:) method. If the app delegate receives a device token, it should connect with its provider and pass it the token. note: Currently the only notification type supported in macOS for non-running apps is icon badging. However, the JSON payload, which may contain information related to sounds and alerts, is passed to a running app in application(_:didReceiveRemoteNotification:). The app can do whatever it wants to with that information (for example, display an alert or play a sound).

## See Also

### Managing remote notifications

- [registerForRemoteNotifications()](appkit/nsapplication/registerforremotenotifications().md)
- [unregisterForRemoteNotifications()](appkit/nsapplication/unregisterforremotenotifications().md)
- [enabledRemoteNotificationTypes](appkit/nsapplication/enabledremotenotificationtypes.md)
- [isRegisteredForRemoteNotifications](appkit/nsapplication/isregisteredforremotenotifications.md)
- [NSApplication.RemoteNotificationType](appkit/nsapplication/remotenotificationtype.md)
