Skip to content

PushKit watchOS xcode14.3 beta1

Alex Soto edited this page Feb 16, 2023 · 2 revisions

#PushKit.framework

diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/PushKit.framework/Headers/PKDefines.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/PushKit.framework/Headers/PKDefines.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/PushKit.framework/Headers/PKDefines.h	2022-09-30 05:09:50
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/PushKit.framework/Headers/PKDefines.h	2023-02-10 08:38:11
@@ -12,5 +12,15 @@
 #else
 #define PK_EXPORT           extern __attribute__((visibility("default")))
 #endif
-
+/// Constants reflecting the push types you want to support.
+///
+/// ## Topics
+///
+/// ### Notification Types
+///
+/// - ``PushKit/PKPushTypeComplication``
+/// - ``PushKit/PKPushTypeFileProvider``
+/// - ``PushKit/PKPushTypeVoIP``
+///
+/// 
 typedef NSString *PKPushType NS_STRING_ENUM;
diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/PushKit.framework/Headers/PKPushCredentials.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/PushKit.framework/Headers/PKPushCredentials.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/PushKit.framework/Headers/PKPushCredentials.h	2022-10-06 13:21:47
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/PushKit.framework/Headers/PKPushCredentials.h	2023-02-12 00:13:19
@@ -10,10 +10,26 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+/// An object that encapsulates the device token you use to deliver push notifications
+/// to your app.
+///
+/// When registering your app's push types, PushKit creates a ``PushKit/PKPushCredentials``
+/// object for each type your app supports and delivers it to your delegate's ``PushKit/PKPushRegistryDelegate/pushRegistry:didUpdatePushCredentials:forType:``
+/// method. Don't create ``PushKit/PKPushCredentials`` objects yourself.
+/// 
 API_AVAILABLE(macos(10.15), macCatalyst(13.0), ios(8.0), watchos(6.0), tvos(13.0))
 @interface PKPushCredentials : NSObject
 
+/// The push type constant associated with the token.
+///
+/// For possible values, see ``PushKit/PKPushType``.
 @property (readonly,copy) PKPushType type;
+/// A unique device token to use when sending push notifications to the current device.
+///
+/// Forward this token to the server you use to generate push notifications. When preparing
+/// to deliver a push notification to the current device, include the token in the HTTP
+/// request you send to Apple Push Notification service (APNs).
+///
 @property (readonly,copy) NSData *token;
 
 @end
diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/PushKit.framework/Headers/PKPushPayload.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/PushKit.framework/Headers/PKPushPayload.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/PushKit.framework/Headers/PKPushPayload.h	2022-10-06 13:21:46
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/PushKit.framework/Headers/PKPushPayload.h	2023-02-12 00:13:19
@@ -9,11 +9,26 @@
 #import <PushKit/PKDefines.h>
 
 NS_ASSUME_NONNULL_BEGIN
-
+/// An object that contains information about a received PushKit notification.
+///
+/// ## Topics
+///
+/// ### Payload Data
+///
+/// - ``PushKit/PKPushPayload/dictionaryPayload``
+/// - ``PushKit/PKPushPayload/type``
+///
 API_AVAILABLE(macos(10.15), macCatalyst(13.0), ios(8.0), watchos(6.0), tvos(13.0))
 @interface PKPushPayload : NSObject
 
+/// The type value indicating how to interpret the payload.
+///
+/// For possible values, see ``PushKit/PKPushType``.
 @property (readonly,copy) PKPushType type;
+/// The contents of the received payload.
+///
+/// For VoIP pushes, the sender is free to specify any fields for the contained data
+/// as long as it is provided in a text-encodable JSON format.
 @property (readonly,copy) NSDictionary *dictionaryPayload;
 
 @end
diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/PushKit.framework/Headers/PKPushRegistry.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/PushKit.framework/Headers/PKPushRegistry.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/PushKit.framework/Headers/PKPushRegistry.h	2022-11-10 19:17:40
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/PushKit.framework/Headers/PKPushRegistry.h	2023-02-12 14:12:47
@@ -10,57 +10,157 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-/* PKPushType constants can be used to register for a PKPushType-specific push token or to identify received push
-   notifications.
- */
+/// A push type for Voice-over-IP (VoIP) call invitations.
+///
+/// Use this type of notification to initiate live voice calls over the network.
+/// Apps receiving VoIP push notifications must report the call quickly to
+/// CallKit, so it can alert the user to the presence of the incoming call. For
+/// apps linked against the iOS 13 SDK or later, the system terminates your app
+/// if you fail to report these notifications to CallKit. If your app repeatedly
+/// fails to report VoIP notifications to CallKit, the system stops launching
+/// your app for VoIP push notifications.
+///
+/// Don't use this type of notification for anything other than initiating VoIP
+/// calls. If you don't want to post the CallKit call interface, handle
+/// notifications with the
+/// <doc://com.apple.documentation/documentation/usernotifications> framework
+/// instead of ``PushKit``. When sending encrypted content, use a Notification
+/// Service Extension to decrypt that content before displaying it to the user.
+/// You can also use a Notification Content Extension to display a custom
+/// interface for your app's notifications. For more information, see
+/// <doc://com.apple.documentation/documentation/usernotifications/modifying_content_in_newly_delivered_notifications>
+/// and
+/// <doc://com.apple.documentation/documentation/usernotificationsui/customizing_the_appearance_of_notifications>.
 PK_EXPORT PKPushType const PKPushTypeVoIP API_AVAILABLE(ios(9.0), macCatalyst(14.0), watchos(9.0)) API_UNAVAILABLE(macos, tvos);
+
+/// A push type for watchOS complications.
+///
+/// Use this type of notification to deliver updated data related for your
+/// watchOS app’s complication. The watchOS app’s complication must be active on
+/// the user’s current clock face. If it is not, the system does not deliver
+/// pushes of this type. For watchOS 6 and later, send the push notification
+/// directly to Apple Watch. For watchOS 5 and earlier, you must send it to the
+/// iOS companion instead.
+///
+/// The time your watchOS app spends processing these push notifications counts
+/// against the budget allotted to your complication for updating itself. Don't
+/// start any long-running tasks when processing the notification payload. In
+/// fact, it is recommended that you include all needed data in the payload so
+/// that your app can process that data quickly.
+///
+/// The system limits you to 50 push notifications per day. If you exceed the
+/// limit, subsequent pushes are not delivered.
 PK_EXPORT PKPushType const PKPushTypeComplication API_AVAILABLE(watchos(6.0)) API_DEPRECATED("Complication pushes are supported directly on watchOS now, so this should no longer be used on iOS.", ios(9.0, 13.0), macCatalyst(9.0, 13.0))  API_UNAVAILABLE(macos, tvos);
+/// A push type for file provider updates.
+///
+/// Use file provider notifications to update your File Provider extension's content
+/// from your server. For more information, see <doc://com.apple.documentation/documentation/fileprovider/nonreplicated_file_provider_extension/content_and_change_tracking/tracking_your_file_provider_s_changes>.
+/// 
 PK_EXPORT PKPushType const PKPushTypeFileProvider API_AVAILABLE(macos(10.15), ios(11.0), macCatalyst(13.0)) API_UNAVAILABLE(watchos, tvos);
 
 @protocol PKPushRegistryDelegate;
 @class PKPushCredentials, PKPushPayload;
 
-/*!
- @class         PKPushRegistry
- @abstract      An instance of this class can be used to register for 3rd party notifications. The supported push
-                notification types are listed above as PKPushType constants.
- */
+/// 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_AVAILABLE(macos(10.15), macCatalyst(13.0), ios(8.0), watchos(6.0), tvos(13.0))
 @interface PKPushRegistry : NSObject
 
-/*!
- @property      delegate
- @abstract      Setting a delegate is required to receive device push tokens and incoming pushes.
- */
+/// 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``.
+/// 
 @property (readwrite,weak,nullable) id<PKPushRegistryDelegate> delegate;
 
-/*!
- @property      desiredPushTypes
- @abstract      An app requests registration for various types of pushes by setting this NSSet to the desired
-                PKPushType constants. Push tokens and notifications will be delivered via delegate callback.
- */
+/// 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``.
+///
 @property (readwrite,copy,nullable) NSSet<PKPushType> *desiredPushTypes;
 
-/*!
- @method        pushTokenForType:
- @abstract      Access the locally cached push token for a specified PKPushType.
- @discussion    A push token returned here has previously been given to the delegate via handlePushTokenUpdate:forType:
-                callback.
- @param         type
-                This is a PKPushType constant that is already in desiredPushTypes.
- @result        Returns the push token that can be used to send pushes to the device for the specified PKPushType.
-                Returns nil if no push token is available for this PKPushType at the time of invocation.
- */
+/// 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.
+/// 
 - (nullable NSData *)pushTokenForType:(PKPushType)type;
 
-/*!
- @method        initWithQueue:
- @abstract      Instantiates a PKPushRegistry with a delegate callback dispatch queue.
- @param         queue
-                All delegate callbacks are performed asynchronously by PKPushRegistry on this queue.
- @result        A PKPushRegistry instance that can be used to register for push tokens and notifications for supported
-                push types.
- */
+/// 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.
+/// 
 - (instancetype)initWithQueue:(nullable dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER;
 
 /*!
@@ -71,63 +171,105 @@
 
 @end
 
-
+/// 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:``
+///
+///
 @protocol PKPushRegistryDelegate <NSObject>
 
 @required
 
-/*!
- @method        pushRegistry:didUpdatePushCredentials:forType:
- @abstract      This method is invoked when new credentials (including push token) have been received for the specified
-                PKPushType.
- @param         registry
-                The PKPushRegistry instance responsible for the delegate callback.
- @param         pushCredentials
-                The push credentials that can be used to send pushes to the device for the specified PKPushType.
- @param         type
-                This is a PKPushType constant which is present in [registry desiredPushTypes].
- */
+/// 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.
+/// 
 - (void)pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials:(PKPushCredentials *)pushCredentials forType:(PKPushType)type;
 
 
 @optional
 
-/*!
- @method        pushRegistry:didReceiveIncomingPushWithPayload:forType:
- @abstract      This method is invoked when a push notification has been received for the specified PKPushType.
- @param         registry
-                The PKPushRegistry instance responsible for the delegate callback.
- @param         payload
-                The push payload sent by a developer via APNS server API.
- @param         type
-                This is a PKPushType constant which is present in [registry desiredPushTypes].
- */
+/// 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]`.
 - (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type API_DEPRECATED_WITH_REPLACEMENT("-pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void(^)(void))completion", ios(8.0, 11.0), macCatalyst(8.0, 11.0)) API_UNAVAILABLE(macos, watchos, tvos);
 
-/*!
- @method        pushRegistry:didReceiveIncomingPushWithPayload:forType:withCompletionHandler:
- @abstract      This method is invoked when a push notification has been received for the specified PKPushType.
- @param         registry
-                The PKPushRegistry instance responsible for the delegate callback.
- @param         payload
-                The push payload sent by a developer via APNS server API.
- @param         type
-                This is a PKPushType constant which is present in [registry desiredPushTypes].
- @param         completion
-                This completion handler should be called to signify the completion of payload processing.
- */
+/// 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.
+/// 
 - (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void(^)(void))completion API_AVAILABLE(macos(10.15), macCatalyst(13.0), ios(11.0), watchos(6.0), tvos(13.0));
 
-/*!
- @method        pushRegistry:didInvalidatePushTokenForType:
- @abstract      This method is invoked if a previously provided push token is no longer valid for use. No action is
-                necessary to rerequest registration. This feedback can be used to update an app's server to no longer
-                send push notifications of the specified type to this device.
- @param         registry
-                The PKPushRegistry instance responsible for the delegate callback.
- @param         type
-                This is a PKPushType constant which is present in [registry desiredPushTypes].
- */
+/// 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]`.
+///
+/// 
 - (void)pushRegistry:(PKPushRegistry *)registry didInvalidatePushTokenForType:(PKPushType)type;
 
 @end
Clone this wiki locally