Register to receive notifications of the specified types from a provider through the Apple Push Notification service.
Deprecated
Use register
instead.
SDK
- macOS 10.7+
Framework
- App
Kit
Declaration
func registerForRemoteNotifications(matching types: NSApplication.Remote Notification Type)
Parameters
types
A bit mask specifying the types of notifications the app accepts. See
NSApplication
for valid bit-mask values..Remote Notification Type
Discussion
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(_:
method; if registration doesn’t succeed, the delegate is informed via the application(_:
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(_:
. The app can do whatever it wants to with that information (for example, display an alert or play a sound).