Package apple.pushkit

Class PKPushRegistry

  • All Implemented Interfaces:
    NSObject

    public class PKPushRegistry
    extends NSObject
    An object that requests the delivery and handles the receipt of PushKit notifications. A `PKPushRegistry` object manages only certain types of notifications, such as high-priority notifications needed by a VoIP app. PushKit wakes up your app as needed to deliver incoming notifications and delivers the notifications directly to the push registry object that requested them. Every time your app launches, whether in the foreground or in the background, create a push registry object and configure it. Typically, you keep the push registry object running for the duration of your app. Each push registry object delivers incoming notifications to its ``PushKit/PKPushRegistry/delegate`` object, which also handles the responses for registration requests. The listing below shows how to create a push registry object and request VoIP notifications. Always assign an appropriate delegate object before modifying the ``PushKit/PKPushRegistry/desiredPushTypes`` property. ```objc - (void) registerForVoIPPushes { self.voipRegistry = [[PKPushRegistry alloc] initWithQueue:nil]; self.voipRegistry.delegate = self; // Initiate registration. self.voipRegistry.desiredPushTypes = [NSSet setWithObject:PKPushTypeVoIP]; } ``` Assigning a new value to the ``PushKit/PKPushRegistry/desiredPushTypes`` property registers the push registry object with the PushKit servers. The server reports the success or failure of your registration attempts asynchronously to the push registry, which then reports those results to its delegate object. The push registry also delivers all received notifications to the delegate object. For more information about the delegate methods, see ``PushKit/PKPushRegistryDelegate``. ## Topics ### Initializing a Push Registry - ``PushKit/PKPushRegistry/initWithQueue:`` ### Receiving the Notification Data - ``PushKit/PKPushRegistry/delegate`` - ``PushKit/PKPushRegistryDelegate`` ### Managing the Push Registry - ``PushKit/PKPushRegistry/desiredPushTypes`` - ``PushKit/PKPushRegistry/pushTokenForType:`` API-Since: 8.0
    • Constructor Detail

      • PKPushRegistry

        protected PKPushRegistry​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static PKPushRegistry allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(@NotNull
                                                                   @NotNull java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(@NotNull
                                                                   @NotNull java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(@NotNull
                                                                                 @NotNull java.lang.Object aTarget,
                                                                                 @NotNull
                                                                                 @NotNull org.moe.natj.objc.SEL aSelector,
                                                                                 @Nullable
                                                                                 @Nullable java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        @NotNull
        public static @NotNull NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        @NotNull
        public static @NotNull org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        @NotNull
        public static @NotNull NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(@NotNull
                                                                                             @NotNull java.lang.String key)
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()
      • delegate

        @Nullable
        public @Nullable PKPushRegistryDelegate delegate()
        The delegate object that receives notifications coming from the push registry object. You must assign a valid object to this property before modifying the ``PushKit/PKPushRegistry/desiredPushTypes`` property. A valid delegate object is required to receive push tokens and payload data from incoming pushes. For more information about the methods of the `PKPushRegistryDelegate` protocol, see ``PushKit/PKPushRegistryDelegate``.
      • desiredPushTypes

        @Nullable
        public @Nullable NSSet<java.lang.String> desiredPushTypes()
        Registers the push types for this push registry object. When you assign a value to this property, the push registry object makes a registration request with the PushKit server. This request is asynchronous, and the success or failure of the request is reported to your registery's delegate object. For a successful registration, PushKit delivers a push token to the delegate. Use that token to generate push requests from your server. For a list of push types that you may include in the set, see ``PushKit/PKPushType``.
      • initWithQueue

        public PKPushRegistry initWithQueue​(@Nullable
                                            @Nullable dispatch_queue_t queue)
        Creates a push registry with the specified dispatch queue. - Parameters: - queue: The dispatch queue on which to execute the delegate methods. It is recommended that you specify a serial queue for this parameter. Specify `nil` to execute the delegate methods on the app’s main queue. - Returns: A `PKPushRegistry` object that you can use to register for push tokens and use to receive notifications.
      • pushTokenForType

        @Nullable
        public @Nullable NSData pushTokenForType​(@NotNull
                                                 @NotNull java.lang.String type)
        Retrieves the locally cached push token for the specified push type. If registration for a specific push type is successful, the push registry delivers the corresponding push token to its delegate and adds a copy of the token to its local cache. Use this method to retrieve the token at a later time. - Parameters: - type: A push type requested by this push registry object. For a list of possible types, see ``PushKit/PKPushType``. - Returns: The push token used to send pushes to the device or `nil` if no token is available for the specified type.
      • setDelegate_unsafe

        public void setDelegate_unsafe​(@Nullable
                                       @Nullable PKPushRegistryDelegate value)
        The delegate object that receives notifications coming from the push registry object. You must assign a valid object to this property before modifying the ``PushKit/PKPushRegistry/desiredPushTypes`` property. A valid delegate object is required to receive push tokens and payload data from incoming pushes. For more information about the methods of the `PKPushRegistryDelegate` protocol, see ``PushKit/PKPushRegistryDelegate``.
      • setDelegate

        public void setDelegate​(@Nullable
                                @Nullable PKPushRegistryDelegate value)
        The delegate object that receives notifications coming from the push registry object. You must assign a valid object to this property before modifying the ``PushKit/PKPushRegistry/desiredPushTypes`` property. A valid delegate object is required to receive push tokens and payload data from incoming pushes. For more information about the methods of the `PKPushRegistryDelegate` protocol, see ``PushKit/PKPushRegistryDelegate``.
      • setDesiredPushTypes

        public void setDesiredPushTypes​(@Nullable
                                        @Nullable NSSet<java.lang.String> value)
        Registers the push types for this push registry object. When you assign a value to this property, the push registry object makes a registration request with the PushKit server. This request is asynchronous, and the success or failure of the request is reported to your registery's delegate object. For a successful registration, PushKit delivers a push token to the delegate. Use that token to generate push requests from your server. For a list of push types that you may include in the set, see ``PushKit/PKPushType``.
      • useStoredAccessor

        @Deprecated
        public static boolean useStoredAccessor()
        Deprecated.