> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt # iOS Session Replay installation 1. 1 ## Install the SDK Required Add PostHog to your Podfile: Podfile ```ruby pod "PostHog", "~> 3.56" ``` Or install via Swift Package Manager: Package.swift ```swift dependencies: [ .package(url: "https://github.com/PostHog/posthog-ios.git", from: "3.56.0") ] ``` **SDK version** Session replay requires PostHog iOS SDK version 3.6.0 or higher. We recommend always using the latest version. 2. 2 ## Enable session recordings in project settings Required Go to your PostHog [Project Settings](https://us.posthog.com/settings/project-replay) and enable **Record user sessions**. Session recordings will not work without this setting enabled. 3. 3 ## Configure PostHog with session replay Required Add `sessionReplay = true` to your PostHog configuration. Here are all the available options: AppDelegate.swift ```swift import Foundation import PostHog import UIKit class AppDelegate: NSObject, UIApplicationDelegate { func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { let POSTHOG_PROJECT_TOKEN = "" let POSTHOG_HOST = "https://us.i.posthog.com" let config = PostHogConfig(projectToken: POSTHOG_PROJECT_TOKEN, host: POSTHOG_HOST) // Enable session recording. Requires enabling in your project settings as well. // Default is false. config.sessionReplay = true // Whether text and text input fields are masked. Default is true. // Password inputs are always masked regardless config.sessionReplayConfig.maskAllTextInputs = true // Whether images are masked. Default is true. config.sessionReplayConfig.maskAllImages = true // Whether logs are captured in recordings. Default is false. // // Support for remote configuration // in the [session replay settings](https://app.posthog.com/settings/project-replay#replay-log-capture) // requires SDK version 3.41.1 or higher. config.sessionReplayConfig.captureLogs = false // Whether network requests are captured in recordings. Default is true // Only metric-like data like speed, size, and response code are captured. // No data is captured from the request or response body. // // Support for remote configuration // in the [session replay settings](https://app.posthog.com/settings/project-replay#replay-network) // requires SDK version 3.41.1 or higher. config.sessionReplayConfig.captureNetworkTelemetry = true // Whether replays are created using high quality screenshots. Default is false. // Required for SwiftUI. // If disabled, replays are created using wireframes instead. // The screenshot may contain sensitive information, so use with caution config.sessionReplayConfig.screenshotMode = true // Experimental. Only applies when `screenshotMode` is enabled. // Moves screenshot rendering off the main thread, which reduces jank // on high refresh rate (120Hz ProMotion) displays. May trigger Xcode's // Main Thread Checker and briefly freeze the app on the first capture. // Default is false. Requires SDK version 3.58.1 or higher. config.sessionReplayConfig.screenshotModeBackgroundCapture = false // Minimum time (in seconds) between snapshots. Default is 1.0s. // Snapshots are taken when views lay out, so this caps how often one // can be captured rather than setting a fixed frame rate. // Lower values can make playback smoother, at the cost of more // capture work on the device. // Note: called `debouncerDelay` before version 3.21.0 config.sessionReplayConfig.throttleDelay = 1.0 // Sample rate for session recordings. A value between 0.0 and 1.0. // 1.0 means 100% of sessions will be recorded. 0.5 means 50%, and so on. // Default is nil (all sessions are recorded). // // Support for remote configuration // in the [session replay triggers](https://us.posthog.com/settings/project-replay#replay-triggers) // requires SDK version 3.42.0 or higher. config.sessionReplayConfig.sampleRate = nil PostHogSDK.shared.setup(config) return true } } ``` For more configuration options, see the [iOS session replay docs](/docs/session-replay/installation?tab=iOS.md). **SwiftUI support** SwiftUI is only supported if the `screenshotMode` option is enabled. Custom views and WebViews also require screenshot mode for full support. 4. 4 ## Watch session recordings Recommended Visit your site or app and interact with it for at least 10 seconds to generate a recording. Navigate between pages, click buttons, and fill out forms to capture meaningful interactions. [Watch your first recording →](https://app.posthog.com/replay/home) 5. 5 ## Next steps Recommended Now that you're recording sessions, continue with the resources below to learn what else Session Replay enables within the PostHog platform. | Resource | Description | | --- | --- | | [Watching recordings](/docs/session-replay/how-to-watch-recordings.md) | How to find and watch session recordings | | [Privacy controls](/docs/session-replay/privacy.md) | How to mask sensitive data in recordings | | [Network recording](/docs/session-replay/network-recording.md) | How to capture network requests in recordings | | [Console log recording](/docs/session-replay/console-log-recording.md) | How to capture console logs in recordings | | [More tutorials](/docs/session-replay/tutorials.md) | Other real-world examples and use cases | ### Still have questions? Ask PostHog AI ### Was this page useful? HelpfulCould be better