### Example: Default Live Activity Setup and Start (Swift) Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/Articles/GettingStarted.md Demonstrates the typical integration of `defaultSetup()` in `AppDelegate` and `defaultStart()` for initiating a Live Activity later in the application flow. ```swift // In AppDelegate if #available(iOS 16.1, *) { Pushwoosh.LiveActivities.defaultSetup() } // Later in your code Pushwoosh.LiveActivities.defaultStart( "order_123", attributes: ["restaurantName": "Burger House"], content: ["status": "Preparing", "estimatedTime": "25 min"] ) ``` -------------------------------- ### Complete Pushwoosh SDK Setup Example Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/PushwooshConfig.md Demonstrates the complete setup of the Pushwoosh SDK within an AppDelegate. This includes setting the delegate, enabling push notification alerts, and registering for push notifications. ```swift class AppDelegate: UIResponder, UIApplicationDelegate, PWMessagingDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { Pushwoosh.configure.delegate = self Pushwoosh.configure.showPushnotificationAlert = true Pushwoosh.configure.registerForPushNotifications() return true } func pushwoosh(_ pushwoosh: Pushwoosh, onMessageOpened message: PWMessage) { handleDeepLink(from: message) } } ``` -------------------------------- ### Start Live Activity with Token and Completion Handler Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/startLiveActivity(withToken:activityId:completion:).md Use this example to start a live activity and register its token with the server. It includes a completion handler to manage the success or failure of the operation. This method is deprecated; prefer the `Pushwoosh/LiveActivities` API. ```swift @available(iOS 16.1, *) func startDeliveryTracking(orderId: String) async throws { let activity = try Activity.request( attributes: DeliveryAttributes(orderId: orderId), content: .init(state: DeliveryState(status: .preparing), staleDate: nil) ) guard let token = activity.pushToken else { return } let tokenString = token.map { String(format: "%02x", $0) }.joined() Pushwoosh.LiveActivities.startLiveActivity(token: tokenString, activityId: orderId) { error in if let error = error { self.logger.error("Failed to register live activity: \(error)") } else { self.logger.info("Live activity registered for order: \(orderId)") } } } ``` -------------------------------- ### Setup Push to Start Live Activities Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/LiveActivities.md Call this function to set up a listener for push-to-start tokens. Requires iOS 17.2+. ```swift @available(iOS 17.2, *) func setupPushToStart() { Task { for await data in Activity.pushToStartTokenUpdates { let token = data.map { String(format: "%02x", $0) }.joined() try? await Pushwoosh.LiveActivities.sendPushToStartLiveActivity(token: token) } } } ``` -------------------------------- ### Setup Live Activity (SDK) Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/Articles/GettingStarted.md Initializes Live Activities support within your application. Use `setup()` for custom attributes or `defaultSetup()` for default attributes. ```APIDOC ## Setup Methods ### Setup with custom attributes (iOS 16.1+) ```swift static func setup( _ activityType: Attributes.Type ) ``` ### Setup with default attributes (iOS 16.1+) ```swift static func defaultSetup() ``` ``` -------------------------------- ### Complete App Setup with Pushwoosh Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/configure.md Integrate Pushwoosh into your application's launch process. This example shows how to set the delegate, enable push notification alerts, and conditionally register for notifications based on user onboarding status. ```swift func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { Pushwoosh.configure.delegate = self Pushwoosh.configure.showPushnotificationAlert = true if userDefaults.bool(forKey: "onboardingComplete") { Pushwoosh.configure.registerForPushNotifications() } return true } ``` -------------------------------- ### Start Activity with Default Attributes (SDK) Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/Articles/GettingStarted.md Starts a Live Activity using the default attributes. This method requires `defaultSetup()` to have been called previously. ```APIDOC ## Default Mode Methods ### Start activity with default attributes (iOS 16.1+) Requires `defaultSetup()` to be called first. ```swift static func defaultStart( _ activityId: String, attributes: [String: Any], content: [String: Any] ) ``` **Example:** ```swift // In AppDelegate if #available(iOS 16.1, *) { Pushwoosh.LiveActivities.defaultSetup() } // Later in your code Pushwoosh.LiveActivities.defaultStart( "order_123", attributes: ["restaurantName": "Burger House"], content: ["status": "Preparing", "estimatedTime": "25 min"] ) ``` ``` -------------------------------- ### Setup Live Activity with Default Attributes (Swift) Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/Articles/GettingStarted.md Use this method for a simplified setup with default attributes, available on iOS 16.1 and later. ```swift static func defaultSetup() ``` -------------------------------- ### Deprecated Usage Example Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/sendPushToStartLiveActivity(token:).md This example shows the deprecated method for sending a Push to Start token. It is recommended to use the `Pushwoosh.LiveActivities.sendPushToStartLiveActivity` API instead. ```swift Pushwoosh.sendPushToStartLiveActivity(token: token) ``` -------------------------------- ### Setting up Push to Start Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/sendPushToStartLiveActivity(token:).md This Swift code demonstrates how to set up Push to Start for Live Activities. It continuously listens for push-to-start token updates and sends them to Pushwoosh. Requires iOS 17.2 or later. ```swift @available(iOS 17.2, *) func setupPushToStart() { Task { for await data in Activity.pushToStartTokenUpdates { let token = data.map { String(format: "%02x", $0) }.joined() try? await Pushwoosh.LiveActivities.sendPushToStartLiveActivity(token: token) } } } ``` -------------------------------- ### Start Live Activity Source: https://context7.com/pushwoosh/pushwoosh-ios-sdk/llms.txt Starts a Live Activity for a specific order and registers its push token with Pushwoosh for real-time updates. ```APIDOC ## `Pushwoosh.LiveActivities.startLiveActivity` ### Description Starts a new Live Activity instance, requests a push token, and registers this token with Pushwoosh to enable server-side updates for the activity. ### Method `Pushwoosh.LiveActivities.startLiveActivity(token:activityId:)` ### Parameters #### Path Parameters - **token** (String) - Required - The push token obtained from the Live Activity. - **activityId** (String) - Required - A unique identifier for the Live Activity. ### Request Example ```swift @available(iOS 16.1, *) func startDeliveryTracking(orderId: String) async { let attributes = DeliveryAttributes(orderId: orderId) let initialState = DeliveryAttributes.DeliveryStatus( statusText: "Order confirmed", estimatedArrival: Date().addingTimeInterval(3600) ) do { let activity = try Activity.request( attributes: attributes, contentState: initialState, pushType: .token ) // Register push token with Pushwoosh for await tokenData in activity.pushTokenUpdates { let token = tokenData.map { String(format: "%02x", $0) }.joined() Pushwoosh.LiveActivities.startLiveActivity( token: token, activityId: "delivery_\(orderId)" ) } } catch { print("Live Activity start failed: \(error)") } } ``` ``` -------------------------------- ### Push-to-Start Payload Example Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/Articles/Examples.md An example JSON payload for initiating a Push-to-Start live activity. It includes alert information, content state, and attributes specific to a delivery. ```json { "aps": { "alert": "Your order is ready!", "content-state": { "status": "preparing", "estimatedArrival": "2024-11-06T15:30:00Z", "currentLocation": "Restaurant" }, "attributes": { "orderNumber": "12345", "driverName": "John", "deliveryAddress": "123 Main St" }, "attributes-type": "DeliveryActivityAttributes", "event": "start" } } ``` -------------------------------- ### Setup Methods Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/PushwooshLiveActivities.md Methods for configuring Live Activities with custom or default attributes. ```APIDOC ## `PushwooshLiveActivitiesImplementationSetup/setup(_:)` ### Description Configures Live Activities with custom attributes. ### Method - `setup(_:)` ``` ```APIDOC ## `PushwooshLiveActivitiesImplementationSetup/defaultSetup()` ### Description Configures Live Activities with default attributes managed by Pushwoosh. ### Method - `defaultSetup()` ``` -------------------------------- ### Setup Push-to-Start Live Activities Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/Articles/Examples.md Configures Pushwoosh Live Activities for Push-to-Start functionality. Requires iOS 17.2 or later. This setup should be called in the application's launch process. ```swift import UIKit import PushwooshFramework import PushwooshLiveActivities @main class AppDelegate: UIResponder, UIApplicationDelegate { func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { if #available(iOS 17.2, *) { Pushwoosh.LiveActivities.setup(DeliveryActivityAttributes.self) } return true } } ``` -------------------------------- ### Token Management (SDK - Manual) Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/Articles/GettingStarted.md Manually manage push-to-start and activity tokens. These methods are only necessary if you are not using the `setup()` or `defaultSetup()` methods. ```APIDOC ## Token Management ### Send push-to-start token (iOS 17.2+) ```swift static func sendPushToStartLiveActivity(token: String) static func sendPushToStartLiveActivity( token: String, completion: @escaping (Error?) -> Void ) ``` ### Register activity token ```swift static func startLiveActivity(token: String, activityId: String) static func startLiveActivity( token: String, activityId: String, completion: @escaping (Error?) -> Void ) ``` ``` -------------------------------- ### Setup Live Activities Source: https://context7.com/pushwoosh/pushwoosh-ios-sdk/llms.txt Registers the activity type for automatic token management and sets up push-to-start for new activities. ```APIDOC ## `Pushwoosh.LiveActivities.setup` ### Description Registers the activity type for automatic token management and configures the SDK to handle push-to-start notifications for initiating new Live Activities. ### Method `Pushwoosh.LiveActivities.setup(_:)` ### Parameters #### Path Parameters - `activityAttributes`: The `ActivityAttributes` type for your Live Activity. ### Code Example ```swift import PushwooshFramework import ActivityKit @available(iOS 16.1, *) func setupLiveActivities() { // Register the activity type for automatic token management Pushwoosh.LiveActivities.setup(DeliveryAttributes.self) // Push-to-start: server can initiate a NEW activity (iOS 17.2+) if #available(iOS 17.2, *) { Task { for await tokenData in Activity.pushToStartTokenUpdates { let token = tokenData.map { String(format: "%02x", $0) }.joined() Pushwoosh.LiveActivities.sendPushToStartLiveActivity(token: token) } } } } ``` ``` -------------------------------- ### Push-to-Start Payload Example Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/Articles/Examples.md An example of a push notification payload designed to trigger a Push-to-Start live activity. This payload includes alert messages, content state, and custom attributes. ```APIDOC ## Push-to-Start Payload ```json { "aps": { "alert": "Your order is ready!", "content-state": { "status": "preparing", "estimatedArrival": "2024-11-06T15:30:00Z", "currentLocation": "Restaurant" }, "attributes": { "orderNumber": "12345", "driverName": "John", "deliveryAddress": "123 Main St" }, "attributes-type": "DeliveryActivityAttributes", "event": "start" } } ``` ``` -------------------------------- ### Starting Ride Tracking Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/Articles/Examples.md This function demonstrates how to start a live activity for ride tracking with custom attributes. It requires iOS 16.1 or later. ```APIDOC ## Starting Ride Tracking ```swift import ActivityKit import PushwooshLiveActivities func startRideTracking(rideId: String, driver: String, vehicle: String, plate: String, destination: String) { guard #available(iOS 16.1, *) else { return } let attributes = RideActivityAttributes( pushwoosh: .create(activityId: "ride-\(rideId)"), driverName: driver, vehicleModel: vehicle, licensePlate: plate, destination: destination ) let contentState = RideActivityAttributes.ContentState( pushwoosh: nil, status: .driverEnRoute, estimatedArrival: Date().addingTimeInterval(300), distanceRemaining: "0.8 mi" ) do { _ = try Activity.request( attributes: attributes, contentState: contentState, pushType: .token ) } catch { print("Failed to start ride tracking: \(error)") } } ``` ``` -------------------------------- ### Default Mode Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/PushwooshLiveActivities.md Methods for starting Live Activities using default attributes. ```APIDOC ## `PushwooshLiveActivitiesImplementationSetup/defaultStart(_:attributes:content:)` ### Description Starts a Live Activity using default attributes. ### Method - `defaultStart(_:attributes:content:)` ``` -------------------------------- ### Setup Push-to-Start Live Activity Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/sendPushToStartLiveActivity(token:completion:).md Use this snippet to set up the push-to-start live activity by listening for token updates and sending them to the server. Requires iOS 17.2 or later. ```swift @available(iOS 17.2, *) func setupPushToStartLiveActivity() { Task { for await token in Activity.pushToStartTokenUpdates { let tokenString = token.map { String(format: "%02x", $0) }.joined() Pushwoosh.LiveActivities.sendPushToStartLiveActivity(token: tokenString) { error in if let error = error { self.logger.error("Failed to send push-to-start token: \(error)") } else { self.logger.info("Push-to-start token registered") } } } } } ``` -------------------------------- ### Register with App Version and Install Source Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/registerForPushNotifications(with:).md Use this snippet to register for push notifications and set tags related to the app's version and how it was installed. Useful for tracking app lifecycle and acquisition channels. ```swift func setupPushNotifications() { let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String let installSource = InstallTracker.getInstallSource() Pushwoosh.configure.registerForPushNotifications(with: [ "app_version": appVersion ?? "unknown", "install_source": installSource, "first_launch": true ]) } ``` -------------------------------- ### Run Pod Install Command Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/README.md Execute this command in your terminal after updating your Podfile to install the specified CocoaPods dependencies. ```bash pod install ``` -------------------------------- ### Start Live Activity with Error Handling Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/Articles/Examples.md Demonstrates how to start a Live Activity with Pushwoosh, including handling potential authorization and general errors. Requires iOS 16.1 or later. ```swift import ActivityKit import PushwooshLiveActivities func startActivityWithErrorHandling() { guard #available(iOS 16.1, *) else { print("Live Activities require iOS 16.1+") return } let attributes = DeliveryActivityAttributes( pushwoosh: .create(activityId: "delivery-123"), orderNumber: "123", driverName: "John", deliveryAddress: "123 Main St" ) let contentState = DeliveryActivityAttributes.ContentState( pushwoosh: nil, status: .preparing, estimatedArrival: Date().addingTimeInterval(1800), currentLocation: "Restaurant" ) do { let activity = try Activity.request( attributes: attributes, contentState: contentState, pushType: .token ) print("Activity started: \(activity.id)") } catch let error as ActivityAuthorizationError { print("Authorization error: \(error.localizedDescription)") } catch { print("Failed to start activity: \(error.localizedDescription)") } } ``` -------------------------------- ### Push-to-Start Setup Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/Articles/Examples.md This code snippet shows how to set up Pushwoosh Live Activities for the Push-to-Start feature, which requires iOS 17.2 or later. It should be placed in your AppDelegate. ```APIDOC ## Push-to-Start Setup ```swift import UIKit import PushwooshFramework import PushwooshLiveActivities @main class AppDelegate: UIResponder, UIApplicationDelegate { func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { if #available(iOS 17.2, *) { Pushwoosh.LiveActivities.setup(DeliveryActivityAttributes.self) } return true } } ``` ``` -------------------------------- ### Starting Timer with Progress Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/Articles/Examples.md This function starts a default live activity to display a timer with progress, suitable for workouts. It requires iOS 16.1 or later. ```APIDOC ## Timer with Progress ```swift import PushwooshLiveActivities func startTimer(duration: Int) { guard #available(iOS 16.1, *) else { return } let endTime = Date().addingTimeInterval(TimeInterval(duration)) let attributes = ["timerType": "workout"] let content = [ "title": "Workout Timer", "endTime": ISO8601DateFormatter().string(from: endTime), "progress": 0.0 ] as [String : Any] Pushwoosh.LiveActivities.defaultStart( "workout-timer", attributes: attributes, content: content ) } ``` ``` -------------------------------- ### Start Live Activity Tracking Source: https://context7.com/pushwoosh/pushwoosh-ios-sdk/llms.txt Initiate a Live Activity, set its initial state, and register its push token with Pushwoosh for real-time updates. ```swift // Start a Live Activity and register its token @available(iOS 16.1, *) func startDeliveryTracking(orderId: String) async { let attributes = DeliveryAttributes(orderId: orderId) let initialState = DeliveryAttributes.DeliveryStatus( statusText: "Order confirmed", estimatedArrival: Date().addingTimeInterval(3600) ) do { let activity = try Activity.request( attributes: attributes, contentState: initialState, pushType: .token ) // Register push token with Pushwoosh for await tokenData in activity.pushTokenUpdates { let token = tokenData.map { String(format: "%02x", $0) }.joined() Pushwoosh.LiveActivities.startLiveActivity( token: token, activityId: "delivery_\(orderId)" ) } } catch { print("Live Activity start failed: \(error)") } } ``` -------------------------------- ### Start Live Activity with Default Attributes (Swift) Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/Articles/GettingStarted.md Initiate a Live Activity using default attributes. This method requires `defaultSetup()` to have been called previously and is available on iOS 16.1+. ```swift static func defaultStart( _ activityId: String, attributes: [String: Any], content: [String: Any] ) ``` -------------------------------- ### Basic Rich Media HTML Content Example Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshTVOS/PushwooshTVOS.docc/Articles/GettingStarted.md An example of basic HTML content for a tvOS Rich Media push notification. It includes styling, text, and interactive links. Ensure all styles are inline. ```html

Welcome to Our Service

Discover amazing content tailored for your Apple TV

``` -------------------------------- ### Start Live Activity and Register with Pushwoosh Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/LiveActivities.md Initiates a Live Activity and registers its push token with Pushwoosh. Ensure the ActivityKit framework and Push Notifications entitlement are configured. ```swift func startDeliveryTracking(order: Order) async throws { let attributes = DeliveryAttributes(orderId: order.id, restaurantName: order.restaurant) let state = DeliveryContentState(status: .preparing, eta: order.estimatedDelivery) let activity = try Activity.request( attributes: attributes, content: .init(state: state, staleDate: nil), pushType: .token ) for await tokenData in activity.pushTokenUpdates { let token = tokenData.map { String(format: "%02x", $0) }.joined() try await Pushwoosh.LiveActivities.startLiveActivity( token: token, activityId: "order_\(order.id)" ) break } } ``` -------------------------------- ### Complete HTML Example for Apple TV Push Notification Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshTVOS/PushwooshTVOS.docc/Articles/HTMLGuide.md This example demonstrates a full HTML structure for a rich push notification on Apple TV, including styling for background, text, input fields, and buttons. Ensure all content elements have the correct `u_content_*` ID format and use inline styles. ```html

Exclusive Offer

Subscribe now and get 30 days free

``` -------------------------------- ### Send Push-to-Start Live Activity Token (Swift) Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/Articles/GettingStarted.md Manually send the push-to-start token for Live Activities. This is only needed if not using the automatic `setup()` or `defaultSetup()` methods. Available for iOS 17.2+. ```swift static func sendPushToStartLiveActivity(token: String) ``` ```swift static func sendPushToStartLiveActivity( token: String, completion: @escaping (Error?) -> Void ) ``` -------------------------------- ### Setup Live Activity with Custom Attributes (Swift) Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/Articles/GettingStarted.md Call this method to set up Live Activities with custom attributes. This is available for iOS 16.1 and later. ```swift static func setup( _ activityType: Attributes.Type ) ``` -------------------------------- ### Configure Pushwoosh with Purchase Delegate Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/purchaseDelegate.md Set up the `purchaseDelegate` in your application's launch method to handle in-app purchase events from rich media. This should be done during application setup. ```swift func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { Pushwoosh.configure.delegate = self Pushwoosh.configure.purchaseDelegate = self Pushwoosh.configure.registerForPushNotifications() return true } ``` -------------------------------- ### Create Food Delivery Widget Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/Articles/GettingStarted.md Implement the Widget struct for your Live Activity. This example configures the display for both the expanded and compact states of the Dynamic Island, as well as the minimal view. ```swift import WidgetKit import SwiftUI import ActivityKit @main struct FoodDeliveryWidget: Widget { var body: some WidgetConfiguration { ActivityConfiguration(for: FoodDeliveryAttributes.self) { context in VStack(alignment: .leading, spacing: 8) { HStack { Text("Order #\(context.attributes.orderNumber)") .font(.headline) Spacer() Text(context.state.emoji) .font(.title) } Text(context.state.status) .font(.subheadline) HStack { Image(systemName: "clock") Text(context.state.estimatedTime) } .font(.caption) } .padding() } dynamicIsland: { DynamicIsland { DynamicIslandExpandedRegion(.leading) { Text(context.state.emoji) .font(.title) } DynamicIslandExpandedRegion(.trailing) { Text(context.state.estimatedTime) .font(.caption) } DynamicIslandExpandedRegion(.center) { Text(context.state.status) .font(.caption) } } compactLeading: { Text(context.state.emoji) } compactTrailing: { Text(context.state.estimatedTime) .font(.caption2) } minimal: { Text(context.state.emoji) } } } } ``` -------------------------------- ### Deprecated startLiveActivity Usage Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/startLiveActivity(withToken:activityId:).md This is the deprecated method signature for starting a live activity. Use `Pushwoosh.LiveActivities.startLiveActivity` instead. ```swift Pushwoosh.LiveActivities.startLiveActivity(token: token, activityId: activityId) ``` -------------------------------- ### startLiveActivity(token:activityId:) Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/LiveActivities.md Starts a Live Activity and registers its push token with Pushwoosh. This function is called after a Live Activity has been successfully requested and its push token is available. ```APIDOC ## Pushwoosh.LiveActivities.startLiveActivity(token:activityId:) ### Description Starts a Live Activity and registers its push token with Pushwoosh. This function is called after a Live Activity has been successfully requested and its push token is available. ### Parameters #### Path Parameters - **token** (String) - Required - The push token for the Live Activity. - **activityId** (String) - Required - A unique identifier for the Live Activity instance. ``` -------------------------------- ### Start Ride Tracking Live Activity Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/Articles/Examples.md Initiates a live activity to track a ride, setting initial attributes and content state. Requires iOS 16.1 or later. ```swift import ActivityKit import PushwooshLiveActivities func startRideTracking(rideId: String, driver: String, vehicle: String, plate: String, destination: String) { guard #available(iOS 16.1, *) else { return } let attributes = RideActivityAttributes( pushwoosh: .create(activityId: "ride-\(rideId)"), driverName: driver, vehicleModel: vehicle, licensePlate: plate, destination: destination ) let contentState = RideActivityAttributes.ContentState( pushwoosh: nil, status: .driverEnRoute, estimatedArrival: Date().addingTimeInterval(300), distanceRemaining: "0.8 mi" ) do { _ = try Activity.request( attributes: attributes, contentState: contentState, pushType: .token ) } catch { print("Failed to start ride tracking: \(error)") } } ``` -------------------------------- ### Starting Simple Notification Counter Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/Articles/Examples.md This function starts a default live activity to display a simple notification counter. It requires iOS 16.1 or later. ```APIDOC ## Simple Notification Counter ```swift import PushwooshLiveActivities func startNotificationCounter() { guard #available(iOS 16.1, *) else { return } let attributes = ["type": "notifications"] let content = [ "title": "Notifications", "count": 1 ] Pushwoosh.LiveActivities.defaultStart( "notification-counter", attributes: attributes, content: content ) } ``` ``` -------------------------------- ### Stop Live Activity Example Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/stopLiveActivity.md Use this method to end a live activity and notify Pushwoosh servers. This example shows how to end delivery tracking. ```swift func completeDelivery() async { await activity.end(dismissalPolicy: .immediate) try? await Pushwoosh.LiveActivities.stopLiveActivity() } ``` -------------------------------- ### Minimal AppDelegate Setup for Pushwoosh tvOS Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshTVOS/PushwooshTVOS.docc/Articles/Examples.md Integrate Pushwoosh into your tvOS app with the minimal required AppDelegate setup. Handles registration and push notification callbacks. ```swift import UIKit import Pushwoosh import PushwooshTVOS @main class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { Pushwoosh.TVoS.setAppCode("XXXXX-XXXXX") // Register for push notifications Pushwoosh.TVoS.registerForTvPushNotifications() return true } func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { Pushwoosh.TVoS.handleTvPushToken(deviceToken) } func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) { Pushwoosh.TVoS.handleTvPushRegistrationFailure(error) } func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { Pushwoosh.TVoS.handleTvPushReceived(userInfo: userInfo, completionHandler: completionHandler) } } ``` -------------------------------- ### Install Optional Pushwoosh SDK Modules Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/README.md Add specific Pushwoosh SDK modules to your project using CocoaPods. Ensure you run 'pod install' after modifying your Podfile. ```ruby pod 'PushwooshXCFramework/PushwooshLiveActivities' pod 'PushwooshXCFramework/PushwooshInboxKit' pod 'PushwooshXCFramework/PushwooshVoIP' pod 'PushwooshXCFramework/PushwooshTVOS' pod 'PushwooshXCFramework/PushwooshForegroundPush' pod 'PushwooshXCFramework/PushwooshKeychain' pod 'PushwooshXCFramework/PushwooshGRPC' pod 'PushwooshInboxUIXCFramework' ``` -------------------------------- ### Register for Push Notifications and Set Tags Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/sharedInstance.md Demonstrates the recommended `configure` method and the alternative `sharedInstance()` method for registering for push notifications and setting tags. Both methods achieve the same result. ```swift Pushwoosh.configure.registerForPushNotifications() Pushwoosh.configure.setTags(["key": "value"]) ``` ```swift Pushwoosh.sharedInstance().registerForPushNotifications() Pushwoosh.sharedInstance().setTags(["key": "value"]) ``` -------------------------------- ### Start Timer Live Activity with Progress Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/Articles/Examples.md Starts a live activity for a timer, such as a workout timer. Requires iOS 16.1 or later. The content includes an end time and a progress value. ```swift import PushwooshLiveActivities func startTimer(duration: Int) { guard #available(iOS 16.1, *) else { return } let endTime = Date().addingTimeInterval(TimeInterval(duration)) let attributes = ["timerType": "workout"] let content = [ "title": "Workout Timer", "endTime": ISO8601DateFormatter().string(from: endTime), "progress": 0.0 ] as [String : Any] Pushwoosh.LiveActivities.defaultStart( "workout-timer", attributes: attributes, content: content ) } ``` -------------------------------- ### Configure Pushwoosh SDK Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/PWConfiguration.md Set up the Pushwoosh SDK by assigning a delegate and registering for push notifications. This is typically done during application launch. ```swift func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { Pushwoosh.configure.delegate = self Pushwoosh.configure.registerForPushNotifications() return true } ``` -------------------------------- ### Support multiple environments Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/initialize(withAppCode:).md Initializes the SDK with different application codes based on the build environment (e.g., development vs. production). ```APIDOC ## Support multiple environments Initializes the SDK with different application codes based on the build environment (e.g., development vs. production). ```swift func setupPushwoosh() { #if DEBUG Pushwoosh.initialize(withAppCode: "DEV-APPCODE") #else Pushwoosh.initialize(withAppCode: "PROD-APPCODE") #endif Pushwoosh.configure.registerForPushNotifications() } ``` ``` -------------------------------- ### Initialize Pushwoosh SDK for Different Environments Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/initialize(withAppCode:).md This example demonstrates how to initialize the Pushwoosh SDK with different app codes based on the build environment (DEBUG or release). It ensures the correct app code is used for development and production. ```swift func setupPushwoosh() { #if DEBUG Pushwoosh.initialize(withAppCode: "DEV-APPCODE") #else Pushwoosh.initialize(withAppCode: "PROD-APPCODE") #endif Pushwoosh.configure.registerForPushNotifications() } ``` -------------------------------- ### Notification Counter Push Payload Example Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/Articles/Examples.md An example of a push notification payload to update a 'Simple Notification Counter' live activity. It specifies the event as 'update' and provides new content state data. ```APIDOC ## Push Payload for Notification Counter ```json { "aps": { "alert": "New notification" }, "live_activity": { "event": "update", "content-state": { "data": { "title": "Notifications", "count": 5 } }, "attributes-type": "DefaultLiveActivityAttributes" } } ``` ``` -------------------------------- ### Start Simple Notification Counter Live Activity Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/Articles/Examples.md Starts a basic live activity to display a notification count. Requires iOS 16.1 or later. This uses the default live activity attributes provided by Pushwoosh. ```swift import PushwooshLiveActivities func startNotificationCounter() { guard #available(iOS 16.1, *) else { return } let attributes = ["type": "notifications"] let content = [ "title": "Notifications", "count": 1 ] Pushwoosh.LiveActivities.defaultStart( "notification-counter", attributes: attributes, content: content ) } ``` -------------------------------- ### Track Subscription Upgrade with Analytics Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/setTags(_:completion:).md This example shows how to track subscription upgrades by setting tags related to the new tier and logging an analytics event upon successful synchronization. It handles potential errors by only logging analytics if tags are synced. ```swift func handleSubscriptionUpgrade(to tier: SubscriptionTier) { let tags: [String: Any] = [ "subscription_tier": tier.rawValue, "subscription_updated": Date(), "isPremium": tier != .free ] Pushwoosh.configure.setTags(tags) { error in if error == nil { Analytics.log("subscription_synced_to_pushwoosh", [ "tier": tier.rawValue ]) } } } ``` -------------------------------- ### Initialize after user consent Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/initialize(withAppCode:).md Initializes the SDK after user privacy consent has been obtained. ```APIDOC ## Initialize after user consent Initializes the SDK after user privacy consent has been obtained. ```swift func handlePrivacyConsentAccepted() { Pushwoosh.initialize(withAppCode: "XXXXX-XXXXX") Pushwoosh.configure.registerForPushNotifications() } ``` ``` -------------------------------- ### Sending SKPaymentTransactions Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/sendSKPaymentTransactions(_:).md This example demonstrates how to send StoreKit payment transactions to Pushwoosh within your `SKPaymentTransactionObserver`. ```APIDOC ## ``Pushwoosh/sendSKPaymentTransactions(_:)`` ### Description Sends in-app purchase transactions to Pushwoosh. ### Overview Automatically tracks StoreKit purchases for: - Revenue analytics in Pushwoosh Control Panel - Purchase-based user segmentation - Conversion tracking - LTV (Lifetime Value) calculations This is the recommended method for tracking StoreKit purchases. ### Example Track purchases in payment queue observer: ```swift class StoreManager: NSObject, SKPaymentTransactionObserver { func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) { Pushwoosh.configure.sendSKPaymentTransactions(transactions) for transaction in transactions { switch transaction.transactionState { case .purchased: handlePurchase(transaction) queue.finishTransaction(transaction) case .failed: handleFailure(transaction) queue.finishTransaction(transaction) case .restored: handleRestore(transaction) queue.finishTransaction(transaction) default: break } } } } ``` Filter transactions before sending: ```swift func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) { let completedTransactions = transactions.filter { $0.transactionState == .purchased || $0.transactionState == .restored } if !completedTransactions.isEmpty { Pushwoosh.configure.sendSKPaymentTransactions(completedTransactions) } } ``` ### See Also - ``Pushwoosh/sendPurchase(_:withPrice:currencyCode:andDate:)`` - ``PWPurchaseDelegate`` ``` -------------------------------- ### Load User Preferences Using Pushwoosh Tags Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/PushwooshGetTagsHandler.md This example demonstrates how to fetch user preferences stored as tags on Pushwoosh servers and update local settings accordingly. It defines success and error handlers for the `getTags` method. Use this when you need to synchronize application state with user-specific data stored remotely. ```swift func loadUserPreferences() { let successHandler: PushwooshGetTagsHandler = { tags in guard let tags = tags else { return } if let subscriptionTier = tags["subscription_tier"] as? String { self.userSettings.subscriptionTier = subscriptionTier } if let favoriteCategories = tags["favorite_categories"] as? [String] { self.userSettings.favoriteCategories = favoriteCategories } if let notificationsEnabled = tags["notifications_enabled"] as? Bool { self.userSettings.notificationsEnabled = notificationsEnabled } self.refreshUI() } let errorHandler: PushwooshErrorHandler = { error in self.logger.error("Failed to load preferences: \(error?.localizedDescription ?? \"Unknown error\")") } Pushwoosh.configure.getTags(successHandler, onFailure: errorHandler) } ``` -------------------------------- ### Handle Promoted Purchase from App Store Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/onPW(inAppPurchaseHelperCallPromotedPurchase:).md Implement this method to track the initiation of a promoted purchase and decide whether to defer the purchase or start the purchase flow immediately. It requires custom logic to determine deferral based on user status and onboarding completion. ```swift class PurchaseManager: NSObject, PWPurchaseDelegate { func onPW(inAppPurchaseHelperCallPromotedPurchase identifier: String) { analytics.track("promoted_purchase_initiated", properties: [ "product_id": identifier ]) if shouldDeferPurchase(identifier) { storeDeferredPurchase(identifier) showOnboardingFlow() } else { startPurchaseFlow(productIdentifier: identifier) } } private func shouldDeferPurchase(_ identifier: String) -> Bool { return !userManager.isLoggedIn || !onboardingManager.isComplete } } ``` -------------------------------- ### delegate Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/modalRichMedia.md Gets or sets the delegate object responsible for handling Rich Media lifecycle events. ```APIDOC ## ``PWModalRichMedia/delegate`` ### Description Gets or sets the delegate object responsible for handling Rich Media lifecycle events. ### Properties - **delegate** (PWRichMediaPresentingDelegate?) - Optional - The delegate object conforming to `PWRichMediaPresentingDelegate`. ``` -------------------------------- ### Initialize with dynamic app code Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/initialize(withAppCode:).md Initializes the SDK with a dynamically set application code at runtime. ```APIDOC ## Initialize with dynamic app code Initializes the SDK with a dynamically set application code at runtime. ```swift func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { let appCode = Configuration.pushwooshAppCode Pushwoosh.initialize(withAppCode: appCode) Pushwoosh.configure.delegate = self Pushwoosh.configure.registerForPushNotifications() return true } ``` ``` -------------------------------- ### configure(position:presentAnimation:dismissAnimation:) Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/modalRichMedia.md Configures the presentation style, position, and animations for modal Rich Media. ```APIDOC ## ``PWModalRichMedia/configure(position:presentAnimation:dismissAnimation:)`` ### Description Configures the presentation style, position, and animations for modal Rich Media. ### Parameters #### Path Parameters - **position** (PWModalWindowPosition) - Required - The desired window position for the modal. - **presentAnimation** (PWAnimation) - Required - The animation to use when presenting the modal. - **dismissAnimation** (PWAnimation) - Required - The animation to use when dismissing the modal. ``` -------------------------------- ### Setup Live Activities with Pushwoosh Source: https://context7.com/pushwoosh/pushwoosh-ios-sdk/llms.txt Register your custom Live Activity attributes with Pushwoosh and handle push-to-start tokens for iOS 17.2+. ```swift import PushwooshFramework import ActivityKit // Define your activity attributes conforming to PushwooshLiveActivityAttributes @available(iOS 16.1, *) struct DeliveryAttributes: ActivityAttributes, PushwooshLiveActivityAttributes { public typealias ContentState = DeliveryStatus struct DeliveryStatus: Codable, Hashable { var statusText: String var estimatedArrival: Date } var orderId: String } // In AppDelegate.application(_:didFinishLaunchingWithOptions:) @available(iOS 16.1, *) func setupLiveActivities() { // Register the activity type for automatic token management Pushwoosh.LiveActivities.setup(DeliveryAttributes.self) // Push-to-start: server can initiate a NEW activity (iOS 17.2+) if #available(iOS 17.2, *) { Task { for await tokenData in Activity.pushToStartTokenUpdates { let token = tokenData.map { String(format: "%02x", $0) }.joined() Pushwoosh.LiveActivities.sendPushToStartLiveActivity(token: token) } } } } ``` -------------------------------- ### PushwooshKeychain Usage Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshKeychain/PushwooshKeychain.docc/PushwooshKeychain.md Demonstrates how to check if persistent HWID is active, get the current environment, and clear the persistent HWID for testing purposes. ```APIDOC import PushwooshKeychain // Check if persistent HWID is active if PushwooshKeychainImplementation.isEnabled { print("Persistent HWID is active") } // Get current environment let environment = PushwooshKeychainImplementation.currentEnvironment // Returns: .simulator, .debug, .testFlight, or .appStore // Clear persistent HWID (for testing) PushwooshKeychainImplementation.clearPersistentHWID() ``` -------------------------------- ### Add Pushwoosh Dependency via CocoaPods Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/PushwooshLiveActivities/PushwooshLiveActivities.docc/Articles/GettingStarted.md Add the PushwooshXCFramework pod to your Podfile and run 'pod install' to integrate the SDK using CocoaPods. ```ruby pod 'PushwooshXCFramework' ``` ```bash pod install ``` -------------------------------- ### Configure Legacy Rich Media Presentation Style and Delegate Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/iOS_SDK/Pushwoosh/Pushwoosh/Pushwoosh.docc/Extensions/legacyRichMedia.md Set the Rich Media presentation style to `.legacy` and assign a delegate for handling legacy Rich Media interactions during application launch. ```swift func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { Pushwoosh.media.setRichMediaPresentationStyle(.legacy) Pushwoosh.media.legacyRichMedia.delegate = self Pushwoosh.configure.registerForPushNotifications() return true } ``` -------------------------------- ### Add Pushwoosh SDK via CocoaPods Source: https://github.com/pushwoosh/pushwoosh-ios-sdk/blob/master/README.md Include this line in your Podfile to integrate the Pushwoosh SDK using CocoaPods. This installs the core SDK. ```ruby # Core SDK pod 'PushwooshXCFramework' ``` -------------------------------- ### Send Push to Start Token Source: https://context7.com/pushwoosh/pushwoosh-ios-sdk/llms.txt Sends a push token to Pushwoosh for the 'push-to-start' feature, allowing the server to initiate new Live Activities. ```APIDOC ## `Pushwoosh.LiveActivities.sendPushToStartLiveActivity` ### Description Registers the push token obtained from `Activity.pushToStartTokenUpdates` with Pushwoosh. This enables the server to initiate a new Live Activity on the user's device without the app needing to be open (requires iOS 17.2+). ### Method `Pushwoosh.LiveActivities.sendPushToStartLiveActivity(token:)` ### Parameters #### Path Parameters - **token** (String) - Required - The push token for the push-to-start feature. ### Code Example ```swift // This is typically called within the Task observing Activity.pushToStartTokenUpdates // as shown in the setupLiveActivities example. if #available(iOS 17.2, *) { Task { for await tokenData in Activity.pushToStartTokenUpdates { let token = tokenData.map { String(format: "%02x", $0) }.joined() Pushwoosh.LiveActivities.sendPushToStartLiveActivity(token: token) } } } ``` ```