Description
When using TouchTracker in an app that does not adopt the scene-based lifecycle (i.e., uses the traditional UIApplicationDelegate with a single UIWindow instead of UISceneDelegate / UIWindowScene), enabling shouldDisplayAboveKeyboardWindow causes a crash.
Crash Location
The crash occurs in the following method:
keyboardScene(for screen: UIScreen)
Root Cause
In apps without scene-based lifecycle support, there is no UIWindowScene available. The keyboardScene(for:) method appears to assume that a scene-based lifecycle is in use, and likely accesses scene-related APIs that are unavailable or return nil in non-scene-based apps, leading to a crash.
Steps to Reproduce
- Create an iOS app that uses the traditional
AppDelegate-based lifecycle (no UIScene support — no scene delegate, no scene manifest in Info.plist).
- Add TouchTracker via SPM.
- Set up
TouchTrackingUIView on the app's UIWindow.
- Enable
shouldDisplayAboveKeyboardWindow.
- Trigger the keyboard (e.g., tap a
UITextField).
- → Crash in
keyboardScene(for:).
Expected Behavior
TouchTracker should gracefully handle the case where the app does not use a scene-based lifecycle. If the keyboard window scene is not available, it should fall back to a safe default (e.g., skip the above-keyboard display or use the app's main window instead).
Description
When using TouchTracker in an app that does not adopt the scene-based lifecycle (i.e., uses the traditional
UIApplicationDelegatewith a singleUIWindowinstead ofUISceneDelegate/UIWindowScene), enablingshouldDisplayAboveKeyboardWindowcauses a crash.Crash Location
The crash occurs in the following method:
Root Cause
In apps without scene-based lifecycle support, there is no
UIWindowSceneavailable. ThekeyboardScene(for:)method appears to assume that a scene-based lifecycle is in use, and likely accesses scene-related APIs that are unavailable or returnnilin non-scene-based apps, leading to a crash.Steps to Reproduce
AppDelegate-based lifecycle (noUIScenesupport — no scene delegate, no scene manifest inInfo.plist).TouchTrackingUIViewon the app'sUIWindow.shouldDisplayAboveKeyboardWindow.UITextField).keyboardScene(for:).Expected Behavior
TouchTracker should gracefully handle the case where the app does not use a scene-based lifecycle. If the keyboard window scene is not available, it should fall back to a safe default (e.g., skip the above-keyboard display or use the app's main window instead).