PKPushRegistryDelegate

Trait PKPushRegistryDelegate 

Source
pub unsafe trait PKPushRegistryDelegate: NSObjectProtocol {
    // Provided methods
    unsafe fn pushRegistry_didUpdatePushCredentials_forType(
        &self,
        registry: &PKPushRegistry,
        push_credentials: &PKPushCredentials,
        type: &PKPushType,
    )
       where Self: Sized + Message { ... }
    unsafe fn pushRegistry_didReceiveIncomingPushWithPayload_forType(
        &self,
        registry: &PKPushRegistry,
        payload: &PKPushPayload,
        type: &PKPushType,
    )
       where Self: Sized + Message { ... }
    unsafe fn pushRegistry_didReceiveIncomingPushWithPayload_forType_withCompletionHandler(
        &self,
        registry: &PKPushRegistry,
        payload: &PKPushPayload,
        type: &PKPushType,
        completion: &DynBlock<dyn Fn()>,
    )
       where Self: Sized + Message { ... }
    unsafe fn pushRegistry_didInvalidatePushTokenForType(
        &self,
        registry: &PKPushRegistry,
        type: &PKPushType,
    )
       where Self: Sized + Message { ... }
}
Available on crate feature PKPushRegistry only.
Expand description

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:

See also Apple’s documentation

Provided Methods§

Source

unsafe fn pushRegistry_didUpdatePushCredentials_forType( &self, registry: &PKPushRegistry, push_credentials: &PKPushCredentials, type: &PKPushType, )
where Self: Sized + Message,

Available on crate features PKDefines and PKPushCredentials only.

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.
Source

unsafe fn pushRegistry_didReceiveIncomingPushWithPayload_forType( &self, registry: &PKPushRegistry, payload: &PKPushPayload, type: &PKPushType, )
where Self: Sized + Message,

👎Deprecated
Available on crate features PKDefines and PKPushPayload only.

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].
Source

unsafe fn pushRegistry_didReceiveIncomingPushWithPayload_forType_withCompletionHandler( &self, registry: &PKPushRegistry, payload: &PKPushPayload, type: &PKPushType, completion: &DynBlock<dyn Fn()>, )
where Self: Sized + Message,

Available on crate features PKDefines and PKPushPayload and block2 only.

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 <doc ://com.apple.documentation/documentation/callkit> framework by calling the <doc ://com.apple.documentation/documentation/callkit/cxprovider/1930694-reportnewincomingcallwithuuid> method of your app’s <doc ://com.apple.documentation/documentation/callkit/cxprovider> 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 <doc ://com.apple.documentation/documentation/usernotifications>.

  • 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.
Source

unsafe fn pushRegistry_didInvalidatePushTokenForType( &self, registry: &PKPushRegistry, type: &PKPushType, )
where Self: Sized + Message,

Available on crate feature PKDefines only.

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].

Trait Implementations§

Source§

impl ProtocolType for dyn PKPushRegistryDelegate

Source§

const NAME: &'static str = "PKPushRegistryDelegate"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn PKPushRegistryDelegate

Implementations on Foreign Types§

Source§

impl<T> PKPushRegistryDelegate for ProtocolObject<T>

Implementors§