Contents

registerForRemoteNotifications(matching:)

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

Declaration

func registerForRemoteNotifications(matching types: NSApplication.RemoteNotificationType)

Parameters

  • types:

    A bit mask specifying the types of notifications the app accepts. See Remotenotificationtype for valid bit-mask values.

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(_: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.

See Also

Managing remote notifications