Skip to content

feat(apple): Add session replay trouble shooting page with custom window handling #13753

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions docs/platforms/apple/guides/ios/session-replay/troubleshooting.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
title: Troubleshooting
sidebar_order: 5503
notSupported:
description: "Troubleshoot and resolve common issues with the iOS Session Replay."
---

## Session Replay is not recording with custom window setup

If you have a custom window setup (e.g. multiple instances of `UIWindow`), you need to ensure that the Sentry SDK is able to find the correct window.

When using window scenes, make sure that the main window is assigned in your `UIWindowSceneDelegate`'s [`window` property](https://developer.apple.com/documentation/uikit/uiwindowscenedelegate/window).

```swift
final class SceneDelegate: NSObject, UIWindowSceneDelegate {

var window: UIWindow?

func scene(
_ scene: UIScene,
willConnectTo session: UISceneSession,
options connectionOptions: UIScene.ConnectionOptions
) {
guard let scene = scene as? UIWindowScene else { return }

// Configure your windows here, e.g.
let mainWindow = UIWindow(windowScene: scene)
mainWindow.rootViewController = UIViewController()
mainWindow.makeKeyAndVisible()

// Do not forget to assign the window to the SceneDelegate's window property:
self.window = mainWindow
}
}
```

Alternatively, you can also create a custom proxy variable for the window:

```swift
final class SceneDelegate: NSObject, UIWindowSceneDelegate {

var mainWindow: UIWindow?

func scene(
_ scene: UIScene,
willConnectTo session: UISceneSession,
options connectionOptions: UIScene.ConnectionOptions
) {
guard let scene = scene as? UIWindowScene else { return }

// Configure your windows here, e.g.:
mainWindow = UIWindow(windowScene: scene)
mainWindow.rootViewController = UIViewController()
mainWindow.makeKeyAndVisible()
}

// This is required to make sure that the Sentry SDK can find the correct window:

var window: UIWindow? {
get {
return mainWindow
}
set {
mainWindow = newValue
}
}
}
```
Loading