Instance Method


Register to receive remote notifications of the specified types via Apple Push Notification service.


func registerForRemoteNotifications(matching types: UIRemoteNotificationType)



A bit mask specifying the types of notifications the app accepts. For a list of values, see UIRemoteNotificationType.


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.

iOS does not display or play notification types specified in the notification payload that are not one of the requested ones. For example, if alert messages are not one of the accepted notification types, iOS does not display an alert even if one is specified in the notification payload. To find out what the app’s current notification types are, call the enabledRemoteNotificationTypes() method.