Interface PKPushRegistryDelegate


  • public interface PKPushRegistryDelegate
    The methods that you use to handle incoming PushKit notifications and registration events. Implement the methods of this protocol in an object of your app and assign that object to the ``PushKit/PKPushRegistry/delegate`` property of your `PKPushRegistry` object. Use the methods of this protocol to process incoming notifications and to react to token registration and invalidation. ## Topics ### Responding to Registration Events - ``PushKit/PKPushRegistryDelegate/pushRegistry:didUpdatePushCredentials:forType:`` - ``PushKit/PKPushRegistryDelegate/pushRegistry:didInvalidatePushTokenForType:`` ### Handling an Incoming Notification - ``PushKit/PKPushRegistryDelegate/pushRegistry:didReceiveIncomingPushWithPayload:forType:withCompletionHandler:`` ### Deprecated Methods - ``PushKit/PKPushRegistryDelegate/pushRegistry:didReceiveIncomingPushWithPayload:forType:``
    • Method Detail

      • pushRegistryDidInvalidatePushTokenForType

        default void pushRegistryDidInvalidatePushTokenForType​(@NotNull
                                                               @NotNull PKPushRegistry registry,
                                                               @NotNull
                                                               @NotNull java.lang.String type)
        Tells the delegate that the system invalidated the push token for the specified type. The system calls this method when a previously provided push token is no longer valid for use. No action is necessary on your part to reregister the push type. Instead, use this method to notify your server not to send push notifications using the matching push token. - Parameters: - registry: The ``PushKit/PKPushRegistry`` instance responsible for the delegate callback. - type: This is a ``PushKit/PKPushType`` constant, which is present in `[registry desiredPushTypes]`.
      • pushRegistryDidReceiveIncomingPushWithPayloadForType

        @Deprecated
        default void pushRegistryDidReceiveIncomingPushWithPayloadForType​(@NotNull
                                                                          @NotNull PKPushRegistry registry,
                                                                          @NotNull
                                                                          @NotNull PKPushPayload payload,
                                                                          @NotNull
                                                                          @NotNull java.lang.String type)
        Deprecated.
        Notifies the delegate that a remote push has been received. This method is invoked when a push notification has been received for the specified push type. - Parameters: - registry: The ``PKPushRegistry`` instance responsible for the delegate callback. - payload: The push payload sent by a developer via APNS server API. - type: This is a ``PushKit/PKPushType`` constant, which is present in `[registry desiredPushTypes]`. API-Since: 8.0 Deprecated-Since: 11.0
      • pushRegistryDidUpdatePushCredentialsForType

        void pushRegistryDidUpdatePushCredentialsForType​(@NotNull
                                                         @NotNull PKPushRegistry registry,
                                                         @NotNull
                                                         @NotNull PKPushCredentials pushCredentials,
                                                         @NotNull
                                                         @NotNull java.lang.String type)
        Tells the delegate that the system updated the credentials for the specified type of push notification. The system calls this method when it receives new credentials (including a push token) for the specified push type. - Parameters: - registry: The ``PushKit/PKPushRegistry`` instance responsible for the delegate callback. - credentials: The push credentials that can be used to send pushes to the device for the specified push type. - type: One of the requested notification types. This type is present in the ``PushKit/PKPushRegistry/desiredPushTypes`` property of the push registry.
      • pushRegistryDidReceiveIncomingPushWithPayloadForTypeWithCompletionHandler

        default void pushRegistryDidReceiveIncomingPushWithPayloadForTypeWithCompletionHandler​(@NotNull
                                                                                               @NotNull PKPushRegistry registry,
                                                                                               @NotNull
                                                                                               @NotNull PKPushPayload payload,
                                                                                               @NotNull
                                                                                               @NotNull java.lang.String type,
                                                                                               @NotNull
                                                                                               @NotNull PKPushRegistryDelegate.Block_pushRegistryDidReceiveIncomingPushWithPayloadForTypeWithCompletionHandler completion)
        Tells the delegate that a remote push notification arrived. The system calls this method when it receives a push notification for the specified push type. Use this method to extract data from the notification's payload and to perform the relevant task for that data. For example, use this method to update the complication data of your watchOS app. When you finish the task, execute the provided `completion` handler block to let PushKit know you are finished. When linking against the iOS 13 SDK or later, your implementation of this method must report notifications of type ``PushKit/PKPushTypeVoIP`` to the framework by calling the method of your app's object. When you call that method, the system displays the standard incoming call interface to the user unless an error occurs. For example, the system reports an error if the user enabled Do Not Disturb. You may establish a connection to your VoIP server in tandem with notify CallKit. > Important: On iOS 13.0 and later, if you fail to report a call to CallKit, the system will terminate your app. Repeatedly failing to report calls may cause the system to stop delivering any more VoIP push notifications to your app. If you want to initiate a VoIP call without using CallKit, register for push notifications using the User Notifications framework instead of PushKit. For more information, see . - Parameters: - registry: The ``PushKit/PKPushRegistry`` instance responsible for the delegate callback. - payload: The push payload sent by a developer via APNs server API. - type: This is a ``PushKit/PKPushType`` constant, which is present in `[registry desiredPushTypes]`. - completion: The notification's completion handler. Execute this block when you finish processing the notification. API-Since: 11.0