Instance Method

registerForRemoteNotifications(matching:)

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

Declaration

func registerForRemoteNotifications(matching types: UIRemoteNotificationType)

Parameters

types

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

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.

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.

See Also

Deprecated Methods

func openURL(URL)

Attempts to open the resource at the specified URL.

Deprecated
func scheduleLocalNotification(UILocalNotification)

Schedules a local notification for delivery at its encapsulated date and time.

Deprecated
func presentLocalNotificationNow(UILocalNotification)

Presents a local notification immediately.

Deprecated
func cancelLocalNotification(UILocalNotification)

Cancels the delivery of the specified scheduled local notification.

Deprecated
func cancelAllLocalNotifications()

Cancels the delivery of all scheduled local notifications.

Deprecated
var scheduledLocalNotifications: [UILocalNotification]?

All currently scheduled local notifications.

Deprecated
func setNewsstandIconImage(UIImage?)

Sets the icon of a Newsstand app to an image depicting the current issue of a publication.

Deprecated
func setKeepAliveTimeout(TimeInterval, handler: (() -> Void)? = nil)

Configures a periodic handler for VoIP apps in older versions of iOS.

Deprecated
func clearKeepAliveTimeout()

Removes a previously installed periodic handler block.

Deprecated
func setStatusBarHidden(Bool, with: UIStatusBarAnimation)

Hides or shows the status bar, optionally animating the transition.

Deprecated
var isStatusBarHidden: Bool

A Boolean value that determines whether the status bar is hidden.

Deprecated
func setStatusBarStyle(UIStatusBarStyle, animated: Bool)

Sets the style of the status bar, optionally animating the transition to the new style.

Deprecated
var statusBarStyle: UIStatusBarStyle

The current style of the status bar.

Deprecated
func setStatusBarOrientation(UIInterfaceOrientation, animated: Bool)

Sets the app's status bar to the specified orientation, optionally animating the transition.

Deprecated
var statusBarOrientation: UIInterfaceOrientation

The current orientation of the app's status bar.

Deprecated
func enabledRemoteNotificationTypes()

Returns the types of notifications the app accepts.

Deprecated